Skip to content

Commit a53b465

Browse files
author
Jay Conrod
committed
cmd/go: clarify documentation for 'go get -u'
Also: add a comment in internal/get.newUpgrader as a follow-up to CL 177677. Updates golang#26902 Change-Id: Ibce2807ecb44fa21697ca04a51c44ddca0f661d8 Reviewed-on: https://go-review.googlesource.com/c/go/+/176902 Reviewed-by: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 545cd82 commit a53b465

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

src/cmd/go/alldocs.go

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ those requirements by taking the maximum requested version.)
7777
The -t flag instructs get to consider modules needed to build tests of
7878
packages specified on the command line.
7979
80-
The -u flag instructs get to update dependencies to use newer minor or
81-
patch releases when available. Continuing the previous example,
82-
'go get -u A' will use the latest A with B v1.3.1 (not B v1.2.3).
80+
The -u flag instructs get to update modules providing dependencies
81+
of packages named on the command line to use newer minor or patch
82+
releases when available. Continuing the previous example, 'go get -u A'
83+
will use the latest A with B v1.3.1 (not B v1.2.3). If B requires module C,
84+
but C does not provide any packages needed to build packages in A
85+
(not including tests), then C will not be updated.
8386
8487
The -u=patch flag (not -u patch) also instructs get to update dependencies,
8588
but changes the default to select patch releases.
@@ -757,6 +760,9 @@ func newUpgrader(cmdline map[string]*query, pkgs map[string]bool) *upgrader {
757760
work = work[1:]
758761
m := modload.PackageModule(pkg)
759762
u.upgrade[m.Path] = true
763+
764+
// testImports is empty unless test imports were actually loaded,
765+
// i.e., -t was set or "all" was one of the arguments.
760766
imports, testImports := modload.PackageImports(pkg)
761767
for _, imp := range imports {
762768
add(imp)

0 commit comments

Comments
 (0)