Closed
Description
The spec seems to allow package main to import another package main under another name. However, the experience with the go tool is inconsistent: % cd $GOPATH/src/foo % cat a/a.go package main import _ "foo/b" func init() { println("init: a") } func main() {} % cat b/b.go package main func init() { println("init: b") } func main() {} % rm -f $GOPATH/bin/a % rm -f $GOPATH/bin/b % go install ./a % touch a/a.go % go install ./a # foo/a a/a.go:3: can't find import: "foo/b" % My setup: % go env GOARCH="amd64" GOBIN="" GOCHAR="6" GOEXE="" GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread -fno-common" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/p/go" GOROOT="/usr/local/Cellar/go/1.0.3" GOTOOLDIR="/usr/local/Cellar/go/1.0.3/pkg/tool/darwin_amd64" CGO_ENABLED="1" %