diff options
author | Russ Cox <rsc@golang.org> | 2014-12-08 22:25:51 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-12-08 22:25:51 -0500 |
commit | 9fe6dc01fe37206db07cbcbcf27a92e0f5703f4c (patch) | |
tree | 3d4c2f104a60ade7e8626be5097274e86b8abf70 | |
parent | 8865ed686797c7f55a240257d1e27b05d909e5f9 (diff) | |
download | go-9fe6dc01fe37206db07cbcbcf27a92e0f5703f4c.tar.gz |
[release-branch.go1.4] cmd/go: document import path checking
LGTM=adg
R=adg
CC=golang-codereviews
https://codereview.appspot.com/189760043
-rw-r--r-- | src/cmd/go/doc.go | 21 | ||||
-rw-r--r-- | src/cmd/go/help.go | 21 | ||||
-rwxr-xr-x | src/cmd/go/mkdoc.sh | 2 |
3 files changed, 41 insertions, 3 deletions
diff --git a/src/cmd/go/doc.go b/src/cmd/go/doc.go index 65640fb48..d0d8a8a5b 100644 --- a/src/cmd/go/doc.go +++ b/src/cmd/go/doc.go @@ -875,7 +875,26 @@ listed in the GOPATH environment variable (see 'go help gopath'). The go command attempts to download the version of the package appropriate for the Go release being used. -Run 'go help install' for more. +Run 'go help get' for more. + +Import path checking + +When the custom import path feature described above redirects to a +known code hosting site, each of the resulting packages has two possible +import paths, using the custom domain or the known hosting site. + +A package statement is said to have an "import comment" if it is immediately +followed (before the next newline) by a comment of one of these two forms: + + package math // import "path" + package math /* import "path" * / + +The go command will refuse to install a package with an import comment +unless it is being referred to by that import path. In this way, import comments +let package authors make sure the custom import path is used and not a +direct path to the underlying code hosting site. + +See https://golang.org/s/go14customimport for details. Description of package lists diff --git a/src/cmd/go/help.go b/src/cmd/go/help.go index 201f0e2d7..c590fdb37 100644 --- a/src/cmd/go/help.go +++ b/src/cmd/go/help.go @@ -235,7 +235,26 @@ listed in the GOPATH environment variable (see 'go help gopath'). The go command attempts to download the version of the package appropriate for the Go release being used. -Run 'go help install' for more. +Run 'go help get' for more. + +Import path checking + +When the custom import path feature described above redirects to a +known code hosting site, each of the resulting packages has two possible +import paths, using the custom domain or the known hosting site. + +A package statement is said to have an "import comment" if it is immediately +followed (before the next newline) by a comment of one of these two forms: + + package math // import "path" + package math /* import "path" */ + +The go command will refuse to install a package with an import comment +unless it is being referred to by that import path. In this way, import comments +let package authors make sure the custom import path is used and not a +direct path to the underlying code hosting site. + +See https://golang.org/s/go14customimport for details. `, } diff --git a/src/cmd/go/mkdoc.sh b/src/cmd/go/mkdoc.sh index 12fd7ba3e..e15e8809c 100755 --- a/src/cmd/go/mkdoc.sh +++ b/src/cmd/go/mkdoc.sh @@ -4,6 +4,6 @@ # license that can be found in the LICENSE file. go install # So the next line will produce updated documentation. -go help documentation > doc.go +go help documentation | sed 's; \*/; * /;' >doc.go gofmt -w doc.go |