Russ Cox would like Bryan C. Mills to review this change.
cmd/go: document $GOPROXY, other module adjustments
Also document module use of GOPATH including GOPATH/src/mod
and GOPATH/bin (unless GOBIN is set).
Fixes #26399.
Fixes #26406.
Change-Id: I7be8eaf110f4fa6fc76ea4cd39aea3dd8addf0b0
---
M src/cmd/go/internal/help/helpdoc.go
M src/cmd/go/internal/modfetch/proxy.go
M src/cmd/go/internal/modload/help.go
3 files changed, 116 insertions(+), 9 deletions(-)
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index a5cfffd..2e01541 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -195,6 +195,7 @@
that repository. The supported version control systems are:
Bazaar .bzr
+ Fossil .fossil
Git .git
Mercurial .hg
Subversion .svn
@@ -238,7 +239,7 @@
In particular, it should appear before any raw JavaScript or CSS,
to avoid confusing the go command's restricted parser.
-The vcs is one of "git", "hg", "svn", etc,
+The vcs is one of "bzr", "fossil", "git", "hg", "svn".
The repo-root is the root of the version control system
containing a scheme and not containing a .vcs qualifier.
@@ -260,12 +261,22 @@
same meta tag and then git clone https://code.org/r/p/exproj into
GOPATH/src/example.org.
-New downloaded packages are written to the first directory listed in the GOPATH
-environment variable (For more details see: 'go help gopath').
+When using GOPATH, downloaded packages are written to the first directory
+listed in the GOPATH environment variable.
+(See 'go help gopath-get' and 'go help gopath'.)
-The go command attempts to download the version of the
-package appropriate for the Go release being used.
-Run 'go help get' for more.
+When using modules, downloaded packages are stored in the module cache
+(see 'go help modules-get' and 'go help goproxy'.)
+
+When using modules, an additional variant of the go-import meta tag is
+recognized and is preferred over those listing version control systems.
+That variant uses "mod" as the vcs in the content value, as in:
+
+ <meta name="go-import" content="example.org mod https://code.org/moduleproxy">
+
+This tag means to fetch modules with paths beginning with example.org
+from the module proxy available at the URL https://code.org/moduleproxy.
+See 'go help goproxy' for details about the proxy protocol.
Import path checking
@@ -288,6 +299,9 @@
This makes it possible to copy code into alternate locations in vendor trees
without needing to update import comments.
+Import path checking is also disabled when using modules.
+They are obsoleted by the go.mod file's module statement.
+
See https://golang.org/s/go14customimport for details.
`,
}
@@ -360,6 +374,12 @@
See https://golang.org/doc/code.html for an example.
+GOPATH and Modules
+
+When using modules, GOPATH is no longer used when resolving imports.
+However, it is still used to store downloaded source code,
+in GOPATH/src/mod, and compiled commands, in GOPATH/bin.
+
Internal Directories
Code in or below a directory named "internal" is importable only
@@ -471,6 +491,8 @@
Examples are linux, darwin, windows, netbsd.
GOPATH
For more details see: 'go help gopath'.
+ GOPROXY
+ URL of Go module proxy. See 'go help goproxy'.
GORACE
Options for the race detector.
See https://golang.org/doc/articles/race_detector.html.
diff --git a/src/cmd/go/internal/modfetch/proxy.go b/src/cmd/go/internal/modfetch/proxy.go
index 4cc7457..4c16b90 100644
--- a/src/cmd/go/internal/modfetch/proxy.go
+++ b/src/cmd/go/internal/modfetch/proxy.go
@@ -19,13 +19,78 @@
"cmd/go/internal/semver"
)
+var HelpGoproxy = &base.Command{
+ UsageLine: "goproxy",
+ Short: "module proxy protocol",
+ Long: `
+The go command defaults to downloading modules from version control systems
+directly, just as 'go get' always has. If the GOPROXY environment variable
+is set to the URL of a module proxy, the go command will instead fetch
+all modules from that proxy. No matter the source of the modules, downloaded
+modules must match existing entries in go.sum (see 'go help modules' for
+discussion of verification).
+
+A Go module proxy is any web server that can respond to GET requests for
+URLs of a specified form. The requests have no query parameters, so even
+a site serving from a fixed file system (including a file:/// URL)
+can be a module proxy.
+
+The GET requests sent to a Go module proxy are:
+
+GET $GOPROXY/<module>/@v/list returns a list of all known versions of the
+given module, one per line.
+
+GET $GOPROXY/<module>/@v/<version>.info returns JSON-formatted metadata
+about that version of the given module.
+
+GET $GOPROXY/<module>/@v/<version>.mod returns the go.mod file
+for that version of the given module.
+
+GET $GOPROXY/<module>/@v/<version>.zip returns the zip archive
+for that version of the given module.
+
+To avoid problems when serving from case-sensitive file systems,
+the <module> and <version> elements are case-encoded, replacing every
+uppercase letter with an exclamation mark followed by the correponding
+lower-case letter: github.com/Azure encodes as github.com/!azure.
+
+The JSON-formatted metadata about a given module corresponds to
+this Go data structure, which may be expanded in the future:
+
+ type Info struct {
+ Version string // version string
+ Time time.Time // commit time
+ }
+
+The zip archive for a specific version of a given module is a
+standard zip file that contains the file tree corresponding
+to the module's source code and related files. The archive uses
+slash-separated paths, and every file path in the archive must
+begin with <module>@<version>/, where the module and version are
+substituted directly, not case-encoded. The root of the module
+file tree corresponds to the <module>@<version>/ prefix in the
+archive.
+
+Even when downloading directly from version control systems,
+the go command synthesizes explicit info, mod, and zip files
+and stores them in its local cache, $GOPATH/src/mod/cache/download,
+the same as if it had downloaded them directly from a proxy.
+The cache layout is the same as the proxy URL space, so
+serving $GOPATH/src/mod/cache/download at (or copying it to)
+https://example.com/proxy would let other users access those
+cached module versions with GOPROXY=https://example.com/proxy.
+`
+
var proxyURL = os.Getenv("GOPROXY")
func lookupProxy(path string) (Repo, error) {
+ if strings.Contains(proxyURL, ",") {
+ return nil, fmt.Errorf("invalid $GOPROXY setting: cannot have comma")
+ }
u, err := url.Parse(proxyURL)
if err != nil || u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "file" {
// Don't echo $GOPROXY back in case it has user:password in it (sigh).
- return nil, fmt.Errorf("invalid $GOPROXY setting")
+ return nil, fmt.Errorf("invalid $GOPROXY setting: malformed URL or invalid scheme (must be http, https, file)")
}
return newProxyRepo(u.String(), path)
}
diff --git a/src/cmd/go/internal/modload/help.go b/src/cmd/go/internal/modload/help.go
index b457433..5c51bd3 100644
--- a/src/cmd/go/internal/modload/help.go
+++ b/src/cmd/go/internal/modload/help.go
@@ -49,6 +49,12 @@
GOPATH/src and itself contains a go.mod file or is below a directory
containing a go.mod file.
+In module-aware mode, GOPATH is no longer used as the mechanism
+for resolving the meaning of imports during a build, but it is still used
+for holding downloaded dependencies (in GOPATH/src/mod) and
+for storing installed commands (in GOPATH/bin, when GOBIN is unset;
+see 'go help environment').
+
Defining a module
A module is defined by a tree of Go source files with a go.mod file
@@ -233,7 +239,6 @@
go get github.com/gorilla/mux@c856192 # records v0.0.0-20180517173623-c85619274f5d
go get github.com/gorilla/mux@master # records current meaning of master
-
Module compatibility and semantic versioning
The go command requires that modules use semantic versions and expects that
@@ -286,7 +291,15 @@
See https://research.swtch.com/vgo-import and https://semver.org/
for more information.
-Module verification
+Module code layout
+
+For now, see https://research.swtch.com/vgo-module for information
+about how source code in version control systems is mapped to
+module file trees.
+
+TODO: Add documentation to go command.
+
+Module downloading and verification
The go command maintains, in the main module's root directory alongside
go.mod, a file named go.sum containing the expected cryptographic checksums
@@ -302,6 +315,13 @@
the cached copies of module downloads still match both their recorded
checksums and the entries in go.sum.
+The go command can fetch modules from a proxy instead of connecting
+to source control systems directly, according to the setting of the GOPROXY
+environment variable.
+
+See 'go help goproxy' for details about the proxy and also the format of
+the cached downloaded packages.
+
Modules and vendoring
When using modules, the go command completely ignores vendor directories.
To view, visit change 124707. To unsubscribe, or for help writing mail filters, visit settings.
TryBots beginning. Status page: https://farmer.golang.org/try?commit=9229bb92
Build is still in progress...
This change failed on linux-386:
See https://storage.googleapis.com/go-build-log/9229bb92/linux-386_a409ddea.log
Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report.
19 of 19 TryBots failed:
Failed on linux-386: https://storage.googleapis.com/go-build-log/9229bb92/linux-386_a409ddea.log
Failed on misc-compile-openbsd: https://storage.googleapis.com/go-build-log/9229bb92/misc-compile-openbsd_cf048b17.log
Failed on misc-compile-plan9: https://storage.googleapis.com/go-build-log/9229bb92/misc-compile-plan9_911e1deb.log
Failed on misc-compile-nacl: https://storage.googleapis.com/go-build-log/9229bb92/misc-compile-nacl_006c0873.log
Failed on misc-compile-mips: https://storage.googleapis.com/go-build-log/9229bb92/misc-compile-mips_88f1b439.log
Failed on misc-compile-freebsd: https://storage.googleapis.com/go-build-log/9229bb92/misc-compile-freebsd_9d829d7f.log
Failed on misc-compile-ppc: https://storage.googleapis.com/go-build-log/9229bb92/misc-compile-ppc_8fbcdc4c.log
Failed on misc-compile: https://storage.googleapis.com/go-build-log/9229bb92/misc-compile_f4b063f9.log
Failed on misc-compile-netbsd: https://storage.googleapis.com/go-build-log/9229bb92/misc-compile-netbsd_3d4e2094.log
Failed on nacl-386: https://storage.googleapis.com/go-build-log/9229bb92/nacl-386_2ae8d07b.log
Failed on openbsd-amd64-62: https://storage.googleapis.com/go-build-log/9229bb92/openbsd-amd64-62_9de30e31.log
Failed on js-wasm: https://storage.googleapis.com/go-build-log/9229bb92/js-wasm_1744987e.log
Failed on misc-vet-vetall: https://storage.googleapis.com/go-build-log/9229bb92/misc-vet-vetall_a16372a0.log
Failed on linux-amd64-race: https://storage.googleapis.com/go-build-log/9229bb92/linux-amd64-race_66e89672.log
Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/9229bb92/windows-amd64-2016_d82e5d42.log
Failed on nacl-amd64p32: https://storage.googleapis.com/go-build-log/9229bb92/nacl-amd64p32_ca37a0b7.log
Failed on freebsd-amd64-11_1: https://storage.googleapis.com/go-build-log/9229bb92/freebsd-amd64-11_1_ca8baddf.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/9229bb92/windows-386-2008_3c35ad5a.log
Failed on linux-amd64: https://storage.googleapis.com/go-build-log/9229bb92/linux-amd64_085b59e6.log
Consult https://build.golang.org/ to see whether they are new failures.
Patch set 1:TryBot-Result -1
Uploaded patch set 2: Patch Set 1 was rebased.
Build is still in progress...
This change failed on misc-compile-ppc:
See https://storage.googleapis.com/go-build-log/4aea304f/misc-compile-ppc_20b55f4d.log
Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report.
To view, visit change 124707. To unsubscribe, or for help writing mail filters, visit settings.
19 of 19 TryBots failed:
Failed on misc-compile-ppc: https://storage.googleapis.com/go-build-log/4aea304f/misc-compile-ppc_20b55f4d.log
Failed on misc-compile: https://storage.googleapis.com/go-build-log/4aea304f/misc-compile_7e6cfb0f.log
Failed on misc-compile-nacl: https://storage.googleapis.com/go-build-log/4aea304f/misc-compile-nacl_083a32fb.log
Failed on misc-compile-mips: https://storage.googleapis.com/go-build-log/4aea304f/misc-compile-mips_23844fdf.log
Failed on linux-amd64: https://storage.googleapis.com/go-build-log/4aea304f/linux-amd64_f8c05b13.log
Failed on misc-compile-netbsd: https://storage.googleapis.com/go-build-log/4aea304f/misc-compile-netbsd_11c3e749.log
Failed on misc-compile-openbsd: https://storage.googleapis.com/go-build-log/4aea304f/misc-compile-openbsd_0a5a6480.log
Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/4aea304f/windows-amd64-2016_438e386c.log
Failed on misc-compile-freebsd: https://storage.googleapis.com/go-build-log/4aea304f/misc-compile-freebsd_da07554b.log
Failed on linux-amd64-race: https://storage.googleapis.com/go-build-log/4aea304f/linux-amd64-race_e6d6108c.log
Failed on misc-compile-plan9: https://storage.googleapis.com/go-build-log/4aea304f/misc-compile-plan9_cbab3c5d.log
Failed on nacl-386: https://storage.googleapis.com/go-build-log/4aea304f/nacl-386_93845389.log
Failed on misc-vet-vetall: https://storage.googleapis.com/go-build-log/4aea304f/misc-vet-vetall_29bfe4f5.log
Failed on linux-386: https://storage.googleapis.com/go-build-log/4aea304f/linux-386_125a5238.log
Failed on freebsd-amd64-11_1: https://storage.googleapis.com/go-build-log/4aea304f/freebsd-amd64-11_1_85d94fcb.log
Failed on js-wasm: https://storage.googleapis.com/go-build-log/4aea304f/js-wasm_3ebfc0a1.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/4aea304f/windows-386-2008_f4a5e043.log
Failed on nacl-amd64p32: https://storage.googleapis.com/go-build-log/4aea304f/nacl-amd64p32_5bb09cd2.log
Failed on openbsd-amd64-62: https://storage.googleapis.com/go-build-log/4aea304f/openbsd-amd64-62_2114744b.log
Consult https://build.golang.org/ to see whether they are new failures.
Patch set 2:TryBot-Result -1
Uploaded patch set 3: Patch Set 2 was rebased.
Build is still in progress...
This change failed on misc-compile-ppc:
See https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile-ppc_12d3aec9.log
Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report.
To view, visit change 124707. To unsubscribe, or for help writing mail filters, visit settings.
19 of 19 TryBots failed:
Failed on misc-compile-ppc: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile-ppc_12d3aec9.log
Failed on misc-compile: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile_3aae84f2.log
Failed on misc-compile-nacl: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile-nacl_a99662ed.log
Failed on misc-compile-openbsd: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile-openbsd_3aaf6a81.log
Failed on misc-compile-netbsd: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile-netbsd_c2a8dd89.log
Failed on misc-compile-mips: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile-mips_bba69c18.log
Failed on misc-compile-plan9: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile-plan9_60c63356.log
Failed on misc-compile-freebsd: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-compile-freebsd_a7e65e64.log
Failed on nacl-amd64p32: https://storage.googleapis.com/go-build-log/a1b7bbd8/nacl-amd64p32_4748dab6.log
Failed on linux-386: https://storage.googleapis.com/go-build-log/a1b7bbd8/linux-386_773c89fd.log
Failed on js-wasm: https://storage.googleapis.com/go-build-log/a1b7bbd8/js-wasm_3c9c7f32.log
Failed on linux-amd64: https://storage.googleapis.com/go-build-log/a1b7bbd8/linux-amd64_0031f34f.log
Failed on misc-vet-vetall: https://storage.googleapis.com/go-build-log/a1b7bbd8/misc-vet-vetall_eec48236.log
Failed on openbsd-amd64-62: https://storage.googleapis.com/go-build-log/a1b7bbd8/openbsd-amd64-62_ea1cf7d2.log
Failed on linux-amd64-race: https://storage.googleapis.com/go-build-log/a1b7bbd8/linux-amd64-race_709f6111.log
Failed on nacl-386: https://storage.googleapis.com/go-build-log/a1b7bbd8/nacl-386_c87c8d36.log
Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/a1b7bbd8/windows-amd64-2016_f30373a6.log
Failed on freebsd-amd64-11_1: https://storage.googleapis.com/go-build-log/a1b7bbd8/freebsd-amd64-11_1_967b1b38.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/a1b7bbd8/windows-386-2008_13433298.log
Consult https://build.golang.org/ to see whether they are new failures.
Patch set 3:TryBot-Result -1
Uploaded patch set 4.
Russ Cox uploaded patch set #4 to this change.
cmd/go: document $GOPROXY, other module adjustments
Also document module use of GOPATH including GOPATH/src/mod
and GOPATH/bin (unless GOBIN is set).
Fixes #26399.
Fixes #26406.
Change-Id: I7be8eaf110f4fa6fc76ea4cd39aea3dd8addf0b0
---
M src/cmd/go/internal/help/helpdoc.go
M src/cmd/go/internal/modfetch/proxy.go
M src/cmd/go/internal/modload/help.go
3 files changed, 118 insertions(+), 9 deletions(-)
To view, visit change 124707. To unsubscribe, or for help writing mail filters, visit settings.
Patch set 4:Code-Review +2
7 comments:
File src/cmd/go/internal/help/helpdoc.go:
Patch Set #1, Line 269: (see 'go help modules-get' and 'go help goproxy'.)
).
Patch Set #1, Line 303: They are obsoleted by the go.mod file's module statement.
s/They are/It is/ or s/They/Import path comments/
s/when/for/ (since the sentence starts with “when”)
Patch Set #1, Line 381: in GOPATH/src/mod, and compiled commands, in GOPATH/bin.
parentheses would be easier for me to parse than commas here.
File src/cmd/go/internal/modfetch/proxy.go:
Patch Set #4, Line 27: defaults to downloading
(not sure)
“by default downloads” would shift the emphasis from “defaults” to “downloads”.
File src/cmd/go/internal/modload/help.go:
as the mechanism
for resolving
s/as the mechanism for resolving/to resolve/
for resolving the meaning of imports during a build, but it is still used
for holding
s/it is still used for holding (.*) and storing (.*)/it still holds \1 and stores \2/
To view, visit change 124707. To unsubscribe, or for help writing mail filters, visit settings.
TryBots are happy.
Patch set 4:TryBot-Result +1
Russ Cox uploaded patch set #5 to this change.
cmd/go: document $GOPROXY, other module adjustments
Also document module use of GOPATH including GOPATH/src/mod
and GOPATH/bin (unless GOBIN is set).
Fixes #26399.
Fixes #26406.
Change-Id: I7be8eaf110f4fa6fc76ea4cd39aea3dd8addf0b0
---
M src/cmd/go/internal/help/helpdoc.go
M src/cmd/go/internal/modfetch/proxy.go
M src/cmd/go/internal/modload/help.go
3 files changed, 116 insertions(+), 9 deletions(-)
To view, visit change 124707. To unsubscribe, or for help writing mail filters, visit settings.
Uploaded patch set 5.
(7 comments)
7 comments:
File src/cmd/go/internal/help/helpdoc.go:
Patch Set #1, Line 269: (See 'go help modules-get' and 'go help goproxy'.)
).
Done
Patch Set #1, Line 303: Import path comments are obsoleted by the go.mod file's module statement.
s/They are/It is/ or s/They/Import path comments/
Done
s/when/for/ (since the sentence starts with “when”)
Done
Patch Set #1, Line 381: and compiled commands (in GOPATH/bin).
parentheses would be easier for me to parse than commas here.
Done
File src/cmd/go/internal/modfetch/proxy.go:
Patch Set #4, Line 27: by default downloads mo
(not sure) […]
Done
File src/cmd/go/internal/modload/help.go:
the meaning of imports
during a buil
s/as the mechanism for resolving/to resolve/
Done
during a build, but it still stores downloaded dependencies (in GOPATH/src/mod)
and install
s/it is still used for holding (.*) and storing (. […]
Done
To view, visit change 124707. To unsubscribe, or for help writing mail filters, visit settings.
Russ Cox merged this change.
cmd/go: document $GOPROXY, other module adjustments
Also document module use of GOPATH including GOPATH/src/mod
and GOPATH/bin (unless GOBIN is set).
Fixes #26399.
Fixes #26406.
Change-Id: I7be8eaf110f4fa6fc76ea4cd39aea3dd8addf0b0
Reviewed-on: https://go-review.googlesource.com/124707
Reviewed-by: Bryan C. Mills <bcm...@google.com>
---
M src/cmd/go/internal/help/helpdoc.go
M src/cmd/go/internal/modfetch/proxy.go
M src/cmd/go/internal/modload/help.go
3 files changed, 116 insertions(+), 9 deletions(-)
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index a5cfffd..c6dfaad 100644
+When using modules, downloaded packages are stored in the module cache.
+(See 'go help modules-get' and 'go help goproxy'.)
+
+When using modules, an additional variant of the go-import meta tag is
+recognized and is preferred over those listing version control systems.
+That variant uses "mod" as the vcs in the content value, as in:
+
+ <meta name="go-import" content="example.org mod https://code.org/moduleproxy">
+
+This tag means to fetch modules with paths beginning with example.org
+from the module proxy available at the URL https://code.org/moduleproxy.
+See 'go help goproxy' for details about the proxy protocol.
Import path checking
@@ -288,6 +299,9 @@
This makes it possible to copy code into alternate locations in vendor trees
without needing to update import comments.
+Import path checking is also disabled when using modules.
+Import path comments are obsoleted by the go.mod file's module statement.
+
See https://golang.org/s/go14customimport for details.
`,
}
@@ -360,6 +374,12 @@
See https://golang.org/doc/code.html for an example.
+GOPATH and Modules
+
+When using modules, GOPATH is no longer used for resolving imports.
+However, it is still used to store downloaded source code (in GOPATH/src/mod)
+and compiled commands (in GOPATH/bin).
+
Internal Directories
Code in or below a directory named "internal" is importable only
@@ -471,6 +491,8 @@
Examples are linux, darwin, windows, netbsd.
GOPATH
For more details see: 'go help gopath'.
+ GOPROXY
+ URL of Go module proxy. See 'go help goproxy'.
GORACE
Options for the race detector.
See https://golang.org/doc/articles/race_detector.html.
diff --git a/src/cmd/go/internal/modfetch/proxy.go b/src/cmd/go/internal/modfetch/proxy.go
index 4cc7457..ffd65d4 100644
--- a/src/cmd/go/internal/modfetch/proxy.go
+++ b/src/cmd/go/internal/modfetch/proxy.go
@@ -14,18 +14,85 @@
"strings"
"time"
+ "cmd/go/internal/base"
"cmd/go/internal/modfetch/codehost"
"cmd/go/internal/module"
"cmd/go/internal/semver"
)
+var HelpGoproxy = &base.Command{
+ UsageLine: "goproxy",
+ Short: "module proxy protocol",
+ Long: `
+The go command by default downloads modules from version control systems+`,
+}
+
var proxyURL = os.Getenv("GOPROXY")
func lookupProxy(path string) (Repo, error) {
+ if strings.Contains(proxyURL, ",") {
+ return nil, fmt.Errorf("invalid $GOPROXY setting: cannot have comma")
+ }
u, err := url.Parse(proxyURL)
if err != nil || u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "file" {
// Don't echo $GOPROXY back in case it has user:password in it (sigh).
- return nil, fmt.Errorf("invalid $GOPROXY setting")
+ return nil, fmt.Errorf("invalid $GOPROXY setting: malformed URL or invalid scheme (must be http, https, file)")
}
return newProxyRepo(u.String(), path)
}
diff --git a/src/cmd/go/internal/modload/help.go b/src/cmd/go/internal/modload/help.go
index 8b3b5a3..3efa708 100644
--- a/src/cmd/go/internal/modload/help.go
+++ b/src/cmd/go/internal/modload/help.go
@@ -49,6 +49,10 @@
GOPATH/src and itself contains a go.mod file or is below a directory
containing a go.mod file.
+In module-aware mode, GOPATH no longer defines the meaning of imports
+during a build, but it still stores downloaded dependencies (in GOPATH/src/mod)
+and installed commands (in GOPATH/bin, unless GOBIN is set).
+
Defining a module
A module is defined by a tree of Go source files with a go.mod file
@@ -245,7 +249,6 @@
go get github.com/gorilla/mux@c856192 # records v0.0.0-20180517173623-c85619274f5d
go get github.com/gorilla/mux@master # records current meaning of master
-
Module compatibility and semantic versioning
The go command requires that modules use semantic versions and expects that
@@ -314,7 +317,15 @@
semantic import versioning, and see https://semver.org/ for more about
semantic versioning.
-Module verification
+Module code layout
+
+For now, see https://research.swtch.com/vgo-module for information
+about how source code in version control systems is mapped to
+module file trees.
+
+TODO: Add documentation to go command.
+
+Module downloading and verification
The go command maintains, in the main module's root directory alongside
go.mod, a file named go.sum containing the expected cryptographic checksums
@@ -330,6 +341,13 @@
the cached copies of module downloads still match both their recorded
checksums and the entries in go.sum.
+The go command can fetch modules from a proxy instead of connecting
+to source control systems directly, according to the setting of the GOPROXY
+environment variable.
+
+See 'go help goproxy' for details about the proxy and also the format of
+the cached downloaded packages.
+
Modules and vendoring
When using modules, the go command completely ignores vendor directories.
To view, visit change 124707. To unsubscribe, or for help writing mail filters, visit settings.