]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: clarify documentation for 'go get -u'
authorJay Conrod <jayconrod@google.com>
Mon, 13 May 2019 19:11:31 +0000 (15:11 -0400)
committerJay Conrod <jayconrod@google.com>
Thu, 30 May 2019 21:42:16 +0000 (21:42 +0000)
Also: add a comment in internal/get.newUpgrader as a follow-up to
CL 177677.

Updates #26902

Change-Id: Ibce2807ecb44fa21697ca04a51c44ddca0f661d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/176902
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/alldocs.go
src/cmd/go/internal/modget/get.go

index a78766e228d7e879d00ac4f8a613d7df1571a4ce..2df97a429c5fe1f3138364814050dfa4d3e44503 100644 (file)
 // The -t flag instructs get to consider modules needed to build tests of
 // packages specified on the command line.
 //
-// The -u flag instructs get to update dependencies to use newer minor or
-// patch releases when available. Continuing the previous example,
-// 'go get -u A' will use the latest A with B v1.3.1 (not B v1.2.3).
+// The -u flag instructs get to update modules providing dependencies
+// of packages named on the command line to use newer minor or patch
+// releases when available. Continuing the previous example, 'go get -u A'
+// will use the latest A with B v1.3.1 (not B v1.2.3). If B requires module C,
+// but C does not provide any packages needed to build packages in A
+// (not including tests), then C will not be updated.
 //
 // The -u=patch flag (not -u patch) also instructs get to update dependencies,
 // but changes the default to select patch releases.
index 0babfba390813328f658e8cd9ef644bae0b17271..e2c4c105ddb028a3897a2a703ad4f1149012f90a 100644 (file)
@@ -77,9 +77,12 @@ those requirements by taking the maximum requested version.)
 The -t flag instructs get to consider modules needed to build tests of
 packages specified on the command line.
 
-The -u flag instructs get to update dependencies to use newer minor or
-patch releases when available. Continuing the previous example,
-'go get -u A' will use the latest A with B v1.3.1 (not B v1.2.3).
+The -u flag instructs get to update modules providing dependencies
+of packages named on the command line to use newer minor or patch
+releases when available. Continuing the previous example, 'go get -u A'
+will use the latest A with B v1.3.1 (not B v1.2.3). If B requires module C,
+but C does not provide any packages needed to build packages in A
+(not including tests), then C will not be updated.
 
 The -u=patch flag (not -u patch) also instructs get to update dependencies,
 but changes the default to select patch releases.
@@ -757,6 +760,9 @@ func newUpgrader(cmdline map[string]*query, pkgs map[string]bool) *upgrader {
                        work = work[1:]
                        m := modload.PackageModule(pkg)
                        u.upgrade[m.Path] = true
+
+                       // testImports is empty unless test imports were actually loaded,
+                       // i.e., -t was set or "all" was one of the arguments.
                        imports, testImports := modload.PackageImports(pkg)
                        for _, imp := range imports {
                                add(imp)