https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79122
Bug ID: 79122
Summary: go test -race reports import cycles with gccgo
Product: gcc
Version: 6.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: go
Assignee: ian at airs dot com
Reporter: aconway at redhat dot com
CC: cmang at google dot com
Target Milestone: ---
### What version of Go are you using (`go version`)?
go version go1.6.1 gccgo (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) linux/amd64
### What operating system and processor architecture are you using (`go env`)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/aconway/go:/home/aconway/proton/proton-c/bindings/go"
GORACE=""
GOROOT="/usr/lib/golang"
GOTOOLDIR="/usr/libexec/gcc/x86_64-redhat-linux/6.3.1"
GO15VENDOREXPERIMENT="1"
CC="/usr/bin/gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="/usr/bin/g++"
CGO_ENABLED="1"
### What did you do?
Create a package "tmp" containing a single "tmp.go" source file with one line:
`package tmp`
go test -race tmp
### What did you expect to see?
go test -race tmp
? tmp [no test files]
### What did you see instead?
go test -race tmp
import cycle not allowed
package tmp
imports runtime
imports runtime/internal/atomic
imports runtime/race
imports syscall
imports internal/race
imports runtime/race
I do not have this problem if I use golang's go compiler, only with gccgo. I
can see the problem on a real codebase, but the above reproducer shows it
doesn't require any actual code to exhibit the problem, in particular you don't
need `import "runtime"`.
I have been seeing this problem since Go 1.4. I'm not sure whether it is a gcc
problem or a go tools problem, I am reporting on both sites.