Hi Dan! I did as you told, but go build -race still not functions: zxun@zxun-virtual:~/src/race2$ go build zxun@zxun-virtual:~/src/race2$ ls race2 race.go zxun@zxun-virtual:~/src/race2$ go build -race race2 zxun@zxun-virtual:~/src/race2$ go run -race race.go ================== WARNING: DATA RACE Read at 0x0000006489c0 by main goroutine: main.read() /home/zxun/src/race2/race.go:13 +0x6d main.main() /home/zxun/src/race2/race.go:24 +0x5d
Previous write at 0x0000006489c0 by goroutine 7: main.increase() /home/zxun/src/race2/race.go:9 +0x64 main.main.func1() /home/zxun/src/race2/race.go:19 +0x38 Goroutine 7 (running) created at: main.main() /home/zxun/src/race2/race.go:17 +0x4f ================== 5 Found 1 data race(s) exit status 66 在2022年4月30日星期六 UTC+8 14:22:26<kortschak> 写道: > On Fri, 2022-04-29 at 23:18 -0700, Zhaoxun Yan wrote: > > And then in that folder you run: > > # go build -race > > Nothing happens, at least in my go1.15 > > The race detector needs to run to detect data races; it's not a static > analysis tool. > > So if you execute the binary that you built with `go build -race` you > should see the race report. > > Dan > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/0236f4a2-80d7-4a6b-927b-0024029b5b74n%40googlegroups.com.