tg.wantExecutable("testdata/bin1/helloworld"+exeSuffix, "go install testdata/src/go-cmd-test/helloworld.go did not write testdata/bin1/helloworld")
}
-func TestGodocInstalls(t *testing.T) {
- testenv.MustHaveExternalNetwork(t)
-
- // godoc installs into GOBIN
- tg := testgo(t)
- defer tg.cleanup()
- tg.parallel()
- tg.tempDir("gobin")
- tg.setenv("GOPATH", tg.path("."))
- tg.setenv("GOBIN", tg.path("gobin"))
- tg.run("get", "golang.org/x/tools/cmd/godoc")
- tg.wantExecutable(tg.path("gobin/godoc"), "did not install godoc to $GOBIN")
- tg.unsetenv("GOBIN")
-
- // godoc installs into GOROOT
- goroot := runtime.GOROOT()
- tg.setenv("GOROOT", goroot)
- tg.check(os.RemoveAll(filepath.Join(goroot, "bin", "godoc")))
- tg.run("install", "golang.org/x/tools/cmd/godoc")
- tg.wantExecutable(filepath.Join(goroot, "bin", "godoc"), "did not install godoc to $GOROOT/bin")
-}
-
func TestGoGetNonPkg(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
const (
toRoot targetDir = iota // to bin dir inside package root (default)
toTool // GOROOT/pkg/tool
- toBin // GOROOT/bin
stalePath // the old import path; fail to build
)
"cmd/trace": toTool,
"cmd/vet": toTool,
"cmd/yacc": toTool,
- "golang.org/x/tools/cmd/godoc": toBin,
"code.google.com/p/go.tools/cmd/cover": stalePath,
"code.google.com/p/go.tools/cmd/godoc": stalePath,
"code.google.com/p/go.tools/cmd/vet": stalePath,
// Install cross-compiled binaries to subdirectories of bin.
elem = full
}
- if p.build.BinDir != gobin && goTools[p.ImportPath] == toBin {
- // Override BinDir.
- // This is from a subrepo but installs to $GOROOT/bin
- // by default anyway (like godoc).
- p.target = filepath.Join(gorootBin, elem)
- } else if p.build.BinDir != "" {
+ if p.build.BinDir != "" {
// Install to GOBIN or bin of GOPATH entry.
p.target = filepath.Join(p.build.BinDir, elem)
if !p.Goroot && strings.Contains(elem, "/") && gobin != "" {