]> Cypherpunks repositories - gostls13.git/commit
exp/types: avoid init race in check_test.go.
authorDavid Symonds <dsymonds@golang.org>
Mon, 12 Nov 2012 22:08:33 +0000 (09:08 +1100)
committerDavid Symonds <dsymonds@golang.org>
Mon, 12 Nov 2012 22:08:33 +0000 (09:08 +1100)
commit80f4ff226ff8fb36ba3c8b4808982c6664ce47c3
tree1108deb9fbc10f04d23ed968352c7c5e7ddddfb8
parentc90739e41ebb7e0c0adc1bbdad61a08dc240dffe
exp/types: avoid init race in check_test.go.

There was an init race between
check_test.go:init
        universe.go:def
        use of Universe
and
universe.go:init
        creation of Universe

The order in which init funcs are executed in a package is unspecified.
The test is not currently broken in the golang.org environment
because the go tool compiles the test with non-test sources before test sources,
but other environments may, say, sort the source files before compiling,
and thus trigger this race, causing a nil pointer panic.

R=gri
CC=golang-dev
https://golang.org/cl/6827076
src/pkg/exp/types/check_test.go