https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78912
Bug ID: 78912 Summary: Relative import when compiling with `go build` is not resolved Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: go Assignee: ian at airs dot com Reporter: jdanek at redhat dot com CC: cmang at google dot com Target Milestone: --- Created attachment 40410 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40410&action=edit reproducer_project.zip The attached project compiles with go tool $ go version go version go1.7.3 linux/amd64 $ GOPATH=`pwd` go build electron/broker.go $ ./broker Print from broker.go Print from util.go It does not compile with gccgo (I am running gcc in Docker) $ docker run -v `pwd`:/mnt --rm -it jdanekrh/nightly-gccgo-trunk-docker-image root@d454c37d5d3e:/# cd /mnt root@d454c37d5d3e:/mnt# go version go version go1.7.1 gccgo (GCC) 7.0.0 20161223 (experimental) linux/amd64 root@d454c37d5d3e:/mnt# GOPATH=`pwd` go build electron/broker.go # command-line-arguments electron/broker.go:4:12: error: import file '../util' not found "../util" ^ electron/broker.go:10:5: error: reference to undefined name 'util' util.PrintSomething() I have tried setting the -fgo-relative-import-path option, (GOPATH=`pwd` go build -gccgoflags -fgo-relative-import-path=`pwd`/electron electron/broker.go) but I could not make it work that way either. This bug may be similar to https://github.com/golang/go/issues/3759. The reproducer from that bug compiles fine for me (relative import in that reproducer starts ./, not ../ like in this case).