I was trying to import package by using ( *Context) Import method from go/build package with package name as path and parent directory path to package as srcDir. https://play.golang.org/p/HT524Fr32hz
What did you expect to see?
No error after importing package.
What did you see instead?
cannot find package "httptest" in any of:
/usr/local/go/src/httptest (from $GOROOT)
($GOPATH not set. For more details see: 'go help gopath')
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I was trying to import package by using
( *Context) Import
method fromgo/build
package with package name aspath
and parent directory path to package assrcDir
.https://play.golang.org/p/HT524Fr32hz
What did you expect to see?
No error after importing package.
What did you see instead?
The same applies to packages from GOPATH.
Current implementation:
go/src/go/build/build.go
Line 650 in 447965d
I think if
srcDir
is provided it should be used instead of"src"
constant in Import method.The text was updated successfully, but these errors were encountered: