diff --git a/src/pkg/go/build/path.go b/src/pkg/go/build/path.go index 7c120d064c..e39b5f8fa5 100644 --- a/src/pkg/go/build/path.go +++ b/src/pkg/go/build/path.go @@ -54,6 +54,11 @@ func (t *Tree) PkgDir() string { // BinDir returns the tree's binary executable directory. func (t *Tree) BinDir() string { + if t.Goroot { + if gobin := os.Getenv("GOBIN"); gobin != "" { + return gobin + } + } return filepath.Join(t.Path, "bin") }