aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-03-27 11:16:10 -0400
committerRuss Cox <rsc@golang.org>2012-03-27 11:16:10 -0400
commit671862747ef238f1713170f712e85d1cd6d46685 (patch)
tree7c2913c76fece215e016213699dd23f43a36a381
parent6b0929505ba7d4ede45d587239459d3f2eb8c3d4 (diff)
downloadgo-671862747ef238f1713170f712e85d1cd6d46685.tar.gz
go-671862747ef238f1713170f712e85d1cd6d46685.zip
go/build: fix import check
When we find a package in DIR/src/foo, we only let it be known as foo if there is no other foo in an earlier GOPATH directory or the GOROOT directory. The GOROOT check was looking in GOROOT/src/foo instead of GOROOT/src/pkg/foo, which meant that the import paths "lib9", "libbio", "libmach", and so on were unavailable, and the import paths "math", "errors", and so on were available. Correct this. Fixes #3390. R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/5927050
-rw-r--r--src/pkg/go/build/build.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/go/build/build.go b/src/pkg/go/build/build.go
index 1c7c47231f..d749aef151 100644
--- a/src/pkg/go/build/build.go
+++ b/src/pkg/go/build/build.go
@@ -387,7 +387,7 @@ func (ctxt *Context) Import(path string, srcDir string, mode ImportMode) (*Packa
// but check that using it wouldn't find something
// else first.
if ctxt.GOROOT != "" {
- if dir := ctxt.joinPath(ctxt.GOROOT, "src", sub); ctxt.isDir(dir) {
+ if dir := ctxt.joinPath(ctxt.GOROOT, "src", "pkg", sub); ctxt.isDir(dir) {
goto Found
}
}