Hello Gophers,a question bothers me while reading the doc: The Go Memory
Model
package main
var a string
func f() {
print(a)
}
func hello() {
a = "hello, world\n"
go f()
}
func main() {
hello()
}
This code snippet is OK
But if I exchange the 2 lines in function hello, DATA RACE happens, why?
--
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/5b622597-6c1c-e32c-7c18-a8dab525e322%40gmail.com.