For current master, if you enable -G=3 in the compiler by adding 'Flag.G = 3' at the end of ParseFlags in cmd/compile/internal/base/flag.go, then this command fails
go test -count=1 -race -run=TestOutput runtime/race
This is one of the commands that is run under the "##### Testing race detector" section of the all.bash tests.
The reason is that types2 reports an error "main.go:4:2: x declared but not used" (which does seem most correct) for:
package main
func main() {
done := make(chan bool)
x := 0
go func() {
x = 42
done <- true
}()
x = 43
<-done
}
whereas the current compiler/typechecker (-G=0) does not report any error. (Note that 'go vet' does return the error "vet: ./test.go:4:2: x declared but not used".)
So, we have to decide if we can make this change in the behavior in the typechecker or not. If not, then we need to "fix" types2 to not report this error.
If it's OK to have this change in behavior, then we can make the test work for both by changing the test program (occurs several times in runtime/race/output_test.go) to end with:
For current master, if you enable -G=3 in the compiler by adding 'Flag.G = 3' at the end of ParseFlags in cmd/compile/internal/base/flag.go, then this command fails
This is one of the commands that is run under the "##### Testing race detector" section of the all.bash tests.
The reason is that types2 reports an error "main.go:4:2: x declared but not used" (which does seem most correct) for:
whereas the current compiler/typechecker (-G=0) does not report any error. (Note that 'go vet' does return the error "vet: ./test.go:4:2: x declared but not used".)
So, we have to decide if we can make this change in the behavior in the typechecker or not. If not, then we need to "fix" types2 to not report this error.
If it's OK to have this change in behavior, then we can make the test work for both by changing the test program (occurs several times in runtime/race/output_test.go) to end with: