Skip to content

cmd/go: 'go test --race' needs gcc for main packages on windows #27089

@judwhite

Description

@judwhite

What version of Go are you using (go version)?

go version go1.11rc1 windows/amd64

Does this issue reproduce with the latest release?

  • Yes, reproduces with go 1.11rc1
  • No, doesn't reproduce with go 1.10.3

What operating system and processor architecture are you using (go env)?

windows/amd64
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\jud_white\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Projects\Go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\JUD_WH~1\AppData\Local\Temp\go-build672193350=/tmp/go-build -gno-record-gcc-switches

What did you do?

$ go test -cpu 1,2,4 -count 1 --race ./hello/...
# runtime/cgo
exec: "gcc": executable file not found in %PATH%
FAIL    git.xyz.com/{org}/{repo}/cmd/hello [build failed]

$ go test -cpu 1,2,4 -count 1 ./hello/...
ok      git.xyz.com/{org}/{repo}/cmd/hello   0.105s

It doesn't happen for non-main packages:

$ go test -cpu 1,2,4 -count 1 --race ./hellopkg/...
ok      git.xyz.com/{org}/{repo}/pkg/hellopkg      10.220s

--race by itself is sufficient to repro, you don't need to set the CPU count or disable caching.

What did you expect to see?

ok      git.xyz.com/{org}/{repo}/cmd/hello   0.XYZs

What did you see instead?

# runtime/cgo
exec: "gcc": executable file not found in %PATH%
FAIL    git.xyz.com/{org}/{repo}/cmd/hello [build failed]

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-WindowsRaceDetector

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions