]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: use golang.org/x/... import paths
authorAndrew Gerrand <adg@golang.org>
Sun, 9 Nov 2014 22:27:25 +0000 (09:27 +1100)
committerAndrew Gerrand <adg@golang.org>
Sun, 9 Nov 2014 22:27:25 +0000 (09:27 +1100)
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/168170043

src/cmd/go/doc.go
src/cmd/go/pkg.go
src/cmd/go/test.bash
src/cmd/go/tool.go
src/cmd/go/vet.go

index cf3a54565a202fe35be6aa53d37b50628d05229f..43a31594405b11e63f05dec16a3910fc41c08c71 100644 (file)
@@ -590,7 +590,7 @@ Usage:
 
 Vet runs the Go vet command on the packages named by the import paths.
 
-For more about vet, see 'godoc code.google.com/p/go.tools/cmd/vet'.
+For more about vet, see 'godoc golang.org/x/tools/cmd/vet'.
 For more about specifying packages, see 'go help packages'.
 
 To run the vet tool with specific options, run 'go tool vet'.
index e17326442c9ec8fb82a24243209e4ad29baab871..6efeeb1a9cd6cf0b6926b77aa2a0613b119177fc 100644 (file)
@@ -383,9 +383,10 @@ func findInternal(path string) (index int, ok bool) {
 type targetDir int
 
 const (
-       toRoot targetDir = iota // to bin dir inside package root (default)
-       toTool                  // GOROOT/pkg/tool
-       toBin                   // GOROOT/bin
+       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
 )
 
 // goTools is a map of Go program import path to install target directory.
@@ -399,9 +400,12 @@ var goTools = map[string]targetDir{
        "cmd/objdump":                          toTool,
        "cmd/pack":                             toTool,
        "cmd/yacc":                             toTool,
-       "code.google.com/p/go.tools/cmd/cover": toTool,
-       "code.google.com/p/go.tools/cmd/godoc": toBin,
-       "code.google.com/p/go.tools/cmd/vet":   toTool,
+       "golang.org/x/tools/cmd/cover":         toTool,
+       "golang.org/x/tools/cmd/godoc":         toBin,
+       "golang.org/x/tools/cmd/vet":           toTool,
+       "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,
 }
 
 // expandScanner expands a scanner.List error into all the errors in the list.
@@ -462,6 +466,13 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
        }
 
        if p.Name == "main" {
+               // Report an error when the old code.google.com/p/go.tools paths are used.
+               if goTools[p.ImportPath] == stalePath {
+                       newPath := strings.Replace(p.ImportPath, "code.google.com/p/go.", "golang.org/x/", 1)
+                       e := fmt.Sprintf("the %v command has moved; use %v instead.", p.ImportPath, newPath)
+                       p.Error = &PackageError{Err: e}
+                       return p
+               }
                _, elem := filepath.Split(p.Dir)
                full := buildContext.GOOS + "_" + buildContext.GOARCH + "/" + elem
                if buildContext.GOOS != toolGOOS || buildContext.GOARCH != toolGOARCH {
index 2b5230b1aac3580a2d7a98972eae437c2f750d3f..e0f066f186dbd0db07e86edc519df446bfd74014 100755 (executable)
@@ -433,20 +433,20 @@ TEST godoc installs into GOBIN
 d=$(mktemp -d -t testgoXXX)
 export GOPATH=$d
 mkdir $d/gobin
-GOBIN=$d/gobin ./testgo get code.google.com/p/go.tools/cmd/godoc || ok=false
+GOBIN=$d/gobin ./testgo get golang.org/x/tools/cmd/godoc || ok=false
 if [ ! -x $d/gobin/godoc ]; then
        echo did not install godoc to '$GOBIN'
-       GOBIN=$d/gobin ./testgo list -f 'Target: {{.Target}}' code.google.com/p/go.tools/cmd/godoc || true
+       GOBIN=$d/gobin ./testgo list -f 'Target: {{.Target}}' golang.org/x/tools/cmd/godoc || true
        ok=false
 fi
 
 TEST godoc installs into GOROOT
 GOROOT=$(./testgo env GOROOT)
 rm -f $GOROOT/bin/godoc
-./testgo install code.google.com/p/go.tools/cmd/godoc || ok=false
+./testgo install golang.org/x/tools/cmd/godoc || ok=false
 if [ ! -x $GOROOT/bin/godoc ]; then
        echo did not install godoc to '$GOROOT/bin'
-       ./testgo list -f 'Target: {{.Target}}' code.google.com/p/go.tools/cmd/godoc || true
+       ./testgo list -f 'Target: {{.Target}}' golang.org/x/tools/cmd/godoc || true
        ok=false
 fi
 
@@ -561,8 +561,8 @@ fi
 TEST without GOPATH, go get fails
 d=$(mktemp -d -t testgoXXX)
 mkdir -p $d/src
-if GOPATH= GOROOT=$d ./testgo get -d code.google.com/p/go.codereview/cmd/hgpatch ; then 
-       echo 'go get code.google.com/p/go.codereview/cmd/hgpatch should not succeed with $GOPATH unset'
+if GOPATH= GOROOT=$d ./testgo get -d golang.org/x/codereview/cmd/hgpatch ; then 
+       echo 'go get golang.org/x/codereview/cmd/hgpatch should not succeed with $GOPATH unset'
        ok=false
 fi     
 rm -rf $d
@@ -571,8 +571,8 @@ rm -rf $d
 TEST with GOPATH=GOROOT, go get fails
 d=$(mktemp -d -t testgoXXX)
 mkdir -p $d/src
-if GOPATH=$d GOROOT=$d ./testgo get -d code.google.com/p/go.codereview/cmd/hgpatch ; then
-        echo 'go get code.google.com/p/go.codereview/cmd/hgpatch should not succeed with GOPATH=$GOROOT'
+if GOPATH=$d GOROOT=$d ./testgo get -d golang.org/x/codereview/cmd/hgpatch ; then
+        echo 'go get golang.org/x/codereview/cmd/hgpatch should not succeed with GOPATH=$GOROOT'
         ok=false
 fi
 rm -rf $d
@@ -728,7 +728,7 @@ elif ! grep "case-insensitive file name collision" $d/out >/dev/null; then
 fi
 
 TEST go get cover
-./testgo get code.google.com/p/go.tools/cmd/cover || ok=false
+./testgo get golang.org/x/tools/cmd/cover || ok=false
 
 unset GOPATH
 rm -rf $d
index 6d26f7a4b4ada01e83c84ce2c2b7ca1719b5cb12..c96161e0f9d523965e87f1c11dbff93e73937b4f 100644 (file)
@@ -53,7 +53,7 @@ func tool(toolName string) string {
        // Give a nice message if there is no tool with that name.
        if _, err := os.Stat(toolPath); err != nil {
                if isInGoToolsRepo(toolName) {
-                       fmt.Fprintf(os.Stderr, "go tool: no such tool %q; to install:\n\tgo get code.google.com/p/go.tools/cmd/%s\n", toolName, toolName)
+                       fmt.Fprintf(os.Stderr, "go tool: no such tool %q; to install:\n\tgo get golang.org/x/tools/cmd/%s\n", toolName, toolName)
                } else {
                        fmt.Fprintf(os.Stderr, "go tool: no such tool %q\n", toolName)
                }
index de7befc6115b9cd8ecab69ac9e3e439a2a1d3df8..02ff54b2ac89ce93c42f57ce6b8ca739a848c05b 100644 (file)
@@ -17,7 +17,7 @@ var cmdVet = &Command{
        Long: `
 Vet runs the Go vet command on the packages named by the import paths.
 
-For more about vet, see 'godoc code.google.com/p/go.tools/cmd/vet'.
+For more about vet, see 'godoc golang.org/x/tools/cmd/vet'.
 For more about specifying packages, see 'go help packages'.
 
 To run the vet tool with specific options, run 'go tool vet'.