What does 'go version' print?
go version go1.3.3 linux/amd64
What steps reproduce the problem?
1. mkdir $HOME/src2
2. mkdir $HOME/src2/golang
3. export GOPATH=$HOME/src2/golang
4. mkdir -p $GOPATH/src/foo
5. Put the content of http://play.golang.org/p/gzOX-Obb75 into $GOPATH/src/foo/a.go
6. go run a.go
What happened?
build.ImportDir() and build.Import() fail to correctly resolve Package.ImportPath to
"foo". I think it used (?) to work recently.
I reproduce the problem via https://github.com/kisielk/errcheck but it can be easily
reproduced with the code I provided above. The problem is actually surfacing in
https://github.com/kisielk/gotool which does the build.ImportDir(".", 0) call,
which fails to return the correct ImportPath.
What should have happened instead?
build.ImportDir() and build.Import() with "." should have the same behavior
than when provided os.Getwd(), e.g.:
Do the same code path as would
dir, _ := os.Getwd()
pkg, err := build.Import(".", dir, 0)
should have the same result than:
pkg, err := build.Import(".", ".", 0)