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
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)
The text was updated successfully, but these errors were encountered:
For Import I think this is working-as-intended, but we should consider returning an
error when we need to use the srcDir argument but it is not an absolute path.
ImportDir shouldn't require a srcDir argument if there is no local import, but at
present ImportDir is always treated as a local import. That is probably a minor bug.