From c2ef14610cd691addcce190e8998df47bdb8c002 Mon Sep 17 00:00:00 2001 From: shulhan Date: Wed, 30 Dec 2020 02:19:41 +0700 Subject: [PATCH] content: fix line numbers on output of Timer.Reset example From perspective of someone who may not or may have an experience on having race conditions, the line number "15" a little bit off because it does not have any reference to variable `t`. Especially when the next paragraph said "The race detector shows the problem: an unsynchronized read and write of the variable t". This changes not only fix the line number "15", but also make it consistent with actual output (although its run on Go tip not Go 1.1), ---- % go run -race race.go 950.434733ms ================== WARNING: DATA RACE Read at 0x00c00013e018 by goroutine 8: main.main.func1() race.go:14 +0x126 Previous write at 0x00c00013e018 by main goroutine: main.main() race.go:12 +0x194 Goroutine 8 (running) created at: time.goFunc() .../share/go/src/time/sleep.go:169 +0x51 ================== 1.037465812s 1.706961927s ... ---- the read conflict is on `func 001` (line number 16 on example) and write conflict is on main (line number 14 on example). Change-Id: I3b9a7880178845d8dc4dff38e197fc3eef407e58 Reviewed-on: https://go-review.googlesource.com/c/blog/+/280712 Reviewed-by: Andrew Gerrand --- content/race-detector.article | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/race-detector.article b/content/race-detector.article index d346a19..5a9a0a7 100644 --- a/content/race-detector.article +++ b/content/race-detector.article @@ -105,11 +105,11 @@ What's going on here? Running the program with the race detector enabled is more WARNING: DATA RACE Read by goroutine 5: main.funcĀ·001() - race.go:14 +0x169 + race.go:16 +0x169 Previous write by goroutine 1: main.main() - race.go:15 +0x174 + race.go:14 +0x174 Goroutine 5 (running) created at: time.goFunc()