From a6ad626bac7b32ded33b493cabc905b249a8de5a Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Mon, 24 Jun 2019 17:47:52 -0400 Subject: [PATCH] doc/go1.13: describe changes to 'go get' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Also fix up markup in the “Version validation” section to correct indentation on Chrome. Change-Id: Ib930d324567c086bbd0c67b105272bdfcca77b12 Reviewed-on: https://go-review.googlesource.com/c/go/+/183630 Reviewed-by: Jay Conrod --- doc/go1.13.html | 103 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 77 insertions(+), 26 deletions(-) diff --git a/doc/go1.13.html b/doc/go1.13.html index ec28e38e97..54dc76542d 100644 --- a/doc/go1.13.html +++ b/doc/go1.13.html @@ -167,11 +167,56 @@ Do not send CLs removing the interior tags from such phrases.

Modules

-

- go - get in module mode now supports the version suffix - @patch to request the latest patch release. - TODO(bcmills): expand. +

go get

+ +

+ In module-aware mode, the set of modules updated by + go get -u + is now smaller, and is more consistent with the set of packages updated by + go get -u in GOPATH mode. + go get -u continues to update the + modules and packages named on the command line, but additionally updates only + the modules containing the packages imported by the named packages, + rather than the transitive module requirements of the modules containing the + named packages. +

+ +

+ Note in particular that go get -u + (without additional arguments) now updates only the transitive imports of the + package in the current directory. To instead update all of the packages + transitively imported by the main module (including test dependencies), use + go get -u all. +

+ +

+ As a result of the above changes to + go get -u, the + go get subcommand no longer supports + the -m flag, which caused go get to + stop before loading packages. The -d flag remains supported, and + continues to cause go get to stop after downloading + the source code needed to build dependencies of the named packages. +

+ +

+ In module-aware mode, the go get subcommand now + supports the version suffix @patch. The @patch + suffix indicates that the named module, or module containing the named + package, should be updated to the highest patch release with the same + major and minor versions as the version found in the build list. + If no such version is present in the build list, @patch is + equivalent to the existing @latest suffix. +

+ +

+ Additionally, the go get subcommand now supports + the -t flag in module-aware mode. As in GOPATH mode, + the -t flag instructs go get to include + the packages imported by tests of the packages named on the command + line. If the -t flag is set, the packages imported by tests will + be updated (if the -u flag is set), downloaded, and built (unless + the -d flag is set) along with the usual non-test packages.

Version validation

@@ -206,29 +251,31 @@ Do not send CLs removing the interior tags from such phrases.

- If the main module directly requires a version that fails the above - validation, a corrected version can be obtained by redacting the version to - just the commit hash and re-running a go command such as go - list -m all or go mod tidy. For example, -

require github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c
- can be redacted to -
require github.com/docker/docker e7b5f7dbe98c
- which resolves to -
require github.com/docker/docker v0.7.3-0.20190319215453-e7b5f7dbe98c
-

+ If a require directive in the + main module uses + an invalid pseudo-version, it can usually be corrected by redacting the + version to just the commit hash and re-running a go command, such + as go list -m all + or go mod tidy. For example, +

+
require github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c
+

can be redacted to

+
require github.com/docker/docker e7b5f7dbe98c
+

which currently resolves to

+
require github.com/docker/docker v0.7.3-0.20190319215453-e7b5f7dbe98c

- If the main module has a transitive requirement on a version that fails - validation, the invalid version can still be replaced with a valid one through - the use of a replace - directive in the go.mod file of - the main module. - If the replacement is a commit hash, it will be resolved to the appropriate - pseudo-version. For example, -

replace github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c => github.com/docker/docker e7b5f7dbe98c
- resolves to -
replace github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c => github.com/docker/docker v0.7.3-0.20190319215453-e7b5f7dbe98c
-

+ If one of the transitive dependencies of the main module requires an invalid + version or pseudo-version, the invalid version can be replaced with a valid + one using a + replace directive in + the go.mod file of the main module. If the replacement is a + commit hash, it will be resolved to the appropriate pseudo-version as above. + For example, +

+
replace github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c => github.com/docker/docker e7b5f7dbe98c
+

currently resolves to

+
replace github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c => github.com/docker/docker v0.7.3-0.20190319215453-e7b5f7dbe98c

Go command

@@ -251,6 +298,10 @@ Do not send CLs removing the interior tags from such phrases. files may be searched for directives but ignored during build.

+

+ TODO +

+

Compiler toolchain

-- 2.48.1