Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
844889df
Commit
844889df
authored
Nov 10, 2014
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/go: use golang.org/x/... import paths
LGTM=rsc R=rsc CC=golang-codereviews
https://golang.org/cl/168170043
parent
7f0be1f7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
18 deletions
+29
-18
src/cmd/go/doc.go
src/cmd/go/doc.go
+1
-1
src/cmd/go/pkg.go
src/cmd/go/pkg.go
+17
-6
src/cmd/go/test.bash
src/cmd/go/test.bash
+9
-9
src/cmd/go/tool.go
src/cmd/go/tool.go
+1
-1
src/cmd/go/vet.go
src/cmd/go/vet.go
+1
-1
No files found.
src/cmd/go/doc.go
View file @
844889df
...
@@ -590,7 +590,7 @@ Usage:
...
@@ -590,7 +590,7 @@ Usage:
Vet runs the Go vet command on the packages named by the import paths.
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'.
For more about specifying packages, see 'go help packages'.
To run the vet tool with specific options, run 'go tool vet'.
To run the vet tool with specific options, run 'go tool vet'.
...
...
src/cmd/go/pkg.go
View file @
844889df
...
@@ -383,9 +383,10 @@ func findInternal(path string) (index int, ok bool) {
...
@@ -383,9 +383,10 @@ func findInternal(path string) (index int, ok bool) {
type
targetDir
int
type
targetDir
int
const
(
const
(
toRoot
targetDir
=
iota
// to bin dir inside package root (default)
toRoot
targetDir
=
iota
// to bin dir inside package root (default)
toTool
// GOROOT/pkg/tool
toTool
// GOROOT/pkg/tool
toBin
// GOROOT/bin
toBin
// GOROOT/bin
stalePath
// the old import path; fail to build
)
)
// goTools is a map of Go program import path to install target directory.
// goTools is a map of Go program import path to install target directory.
...
@@ -399,9 +400,12 @@ var goTools = map[string]targetDir{
...
@@ -399,9 +400,12 @@ var goTools = map[string]targetDir{
"cmd/objdump"
:
toTool
,
"cmd/objdump"
:
toTool
,
"cmd/pack"
:
toTool
,
"cmd/pack"
:
toTool
,
"cmd/yacc"
:
toTool
,
"cmd/yacc"
:
toTool
,
"code.google.com/p/go.tools/cmd/cover"
:
toTool
,
"golang.org/x/tools/cmd/cover"
:
toTool
,
"code.google.com/p/go.tools/cmd/godoc"
:
toBin
,
"golang.org/x/tools/cmd/godoc"
:
toBin
,
"code.google.com/p/go.tools/cmd/vet"
:
toTool
,
"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.
// 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
...
@@ -462,6 +466,13 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
}
}
if
p
.
Name
==
"main"
{
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
)
_
,
elem
:=
filepath
.
Split
(
p
.
Dir
)
full
:=
buildContext
.
GOOS
+
"_"
+
buildContext
.
GOARCH
+
"/"
+
elem
full
:=
buildContext
.
GOOS
+
"_"
+
buildContext
.
GOARCH
+
"/"
+
elem
if
buildContext
.
GOOS
!=
toolGOOS
||
buildContext
.
GOARCH
!=
toolGOARCH
{
if
buildContext
.
GOOS
!=
toolGOOS
||
buildContext
.
GOARCH
!=
toolGOARCH
{
...
...
src/cmd/go/test.bash
View file @
844889df
...
@@ -433,20 +433,20 @@ TEST godoc installs into GOBIN
...
@@ -433,20 +433,20 @@ TEST godoc installs into GOBIN
d
=
$(
mktemp
-d
-t
testgoXXX
)
d
=
$(
mktemp
-d
-t
testgoXXX
)
export
GOPATH
=
$d
export
GOPATH
=
$d
mkdir
$d
/gobin
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
if
[
!
-x
$d
/gobin/godoc
]
;
then
echo
did not
install
godoc to
'$GOBIN'
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
ok
=
false
fi
fi
TEST godoc installs into GOROOT
TEST godoc installs into GOROOT
GOROOT
=
$(
./testgo
env
GOROOT
)
GOROOT
=
$(
./testgo
env
GOROOT
)
rm
-f
$GOROOT
/bin/godoc
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
if
[
!
-x
$GOROOT
/bin/godoc
]
;
then
echo
did not
install
godoc to
'$GOROOT/bin'
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
ok
=
false
fi
fi
...
@@ -561,8 +561,8 @@ fi
...
@@ -561,8 +561,8 @@ fi
TEST without GOPATH, go get fails
TEST without GOPATH, go get fails
d
=
$(
mktemp
-d
-t
testgoXXX
)
d
=
$(
mktemp
-d
-t
testgoXXX
)
mkdir
-p
$d
/src
mkdir
-p
$d
/src
if
GOPATH
=
GOROOT
=
$d
./testgo get
-d
code.google.com/p/go.
codereview/cmd/hgpatch
;
then
if
GOPATH
=
GOROOT
=
$d
./testgo get
-d
golang.org/x/
codereview/cmd/hgpatch
;
then
echo
'go get
code.google.com/p/go.
codereview/cmd/hgpatch should not succeed with $GOPATH unset'
echo
'go get
golang.org/x/
codereview/cmd/hgpatch should not succeed with $GOPATH unset'
ok
=
false
ok
=
false
fi
fi
rm
-rf
$d
rm
-rf
$d
...
@@ -571,8 +571,8 @@ rm -rf $d
...
@@ -571,8 +571,8 @@ rm -rf $d
TEST with
GOPATH
=
GOROOT, go get fails
TEST with
GOPATH
=
GOROOT, go get fails
d
=
$(
mktemp
-d
-t
testgoXXX
)
d
=
$(
mktemp
-d
-t
testgoXXX
)
mkdir
-p
$d
/src
mkdir
-p
$d
/src
if
GOPATH
=
$d
GOROOT
=
$d
./testgo get
-d
code.google.com/p/go.
codereview/cmd/hgpatch
;
then
if
GOPATH
=
$d
GOROOT
=
$d
./testgo get
-d
golang.org/x/
codereview/cmd/hgpatch
;
then
echo
'go get
code.google.com/p/go.
codereview/cmd/hgpatch should not succeed with GOPATH=$GOROOT'
echo
'go get
golang.org/x/
codereview/cmd/hgpatch should not succeed with GOPATH=$GOROOT'
ok
=
false
ok
=
false
fi
fi
rm
-rf
$d
rm
-rf
$d
...
@@ -728,7 +728,7 @@ elif ! grep "case-insensitive file name collision" $d/out >/dev/null; then
...
@@ -728,7 +728,7 @@ elif ! grep "case-insensitive file name collision" $d/out >/dev/null; then
fi
fi
TEST go get cover
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
unset
GOPATH
rm
-rf
$d
rm
-rf
$d
...
...
src/cmd/go/tool.go
View file @
844889df
...
@@ -53,7 +53,7 @@ func tool(toolName string) string {
...
@@ -53,7 +53,7 @@ func tool(toolName string) string {
// Give a nice message if there is no tool with that name.
// Give a nice message if there is no tool with that name.
if
_
,
err
:=
os
.
Stat
(
toolPath
);
err
!=
nil
{
if
_
,
err
:=
os
.
Stat
(
toolPath
);
err
!=
nil
{
if
isInGoToolsRepo
(
toolName
)
{
if
isInGoToolsRepo
(
toolName
)
{
fmt
.
Fprintf
(
os
.
Stderr
,
"go tool: no such tool %q; to install:
\n\t
go 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\t
go get
golang.org/x/
tools/cmd/%s
\n
"
,
toolName
,
toolName
)
}
else
{
}
else
{
fmt
.
Fprintf
(
os
.
Stderr
,
"go tool: no such tool %q
\n
"
,
toolName
)
fmt
.
Fprintf
(
os
.
Stderr
,
"go tool: no such tool %q
\n
"
,
toolName
)
}
}
...
...
src/cmd/go/vet.go
View file @
844889df
...
@@ -17,7 +17,7 @@ var cmdVet = &Command{
...
@@ -17,7 +17,7 @@ var cmdVet = &Command{
Long
:
`
Long
:
`
Vet runs the Go vet command on the packages named by the import paths.
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'.
For more about specifying packages, see 'go help packages'.
To run the vet tool with specific options, run 'go tool vet'.
To run the vet tool with specific options, run 'go tool vet'.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment