Last active
August 29, 2015 13:57
-
-
Save agocs/9379893 to your computer and use it in GitHub Desktop.
What happens when you create a data race in Go?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cagocs:examples christopheragocs$ go run shared_memory.go | |
I am a very global string.I have been to LondonI have been to France | |
I am a very global string.I have been to London | |
I am a very global string.I have been to LondonI have been to France | |
cagocs:examples christopheragocs$ go run -race shared_memory.go | |
================== | |
WARNING: DATA RACE | |
Write by goroutine 4: | |
main.writeToSomeString() | |
/Users/christopheragocs/personal/golangIntro/examples/shared_memory.go:26 +0x38 | |
Previous write by goroutine 3: | |
main.writeToSomeString() | |
/Users/christopheragocs/personal/golangIntro/examples/shared_memory.go:26 +0x38 | |
Goroutine 4 (running) created at: | |
main.main() | |
/Users/christopheragocs/personal/golangIntro/examples/shared_memory.go:15 +0xa7 | |
Goroutine 3 (running) created at: | |
main.main() | |
/Users/christopheragocs/personal/golangIntro/examples/shared_memory.go:14 +0x79 | |
================== | |
I am a very global string.I have been to LondonI have been to France | |
I am a very global string.I have been to London | |
I am a very global string.I have been to LondonI have been to France | |
Found 1 data race(s) | |
exit status 66 | |
cagocs:examples christopheragocs$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment