diff options
author | Bryan C. Mills <bcmills@google.com> | 2021-04-29 09:27:40 -0400 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2021-04-30 18:06:46 +0000 |
commit | 7dedc237c528fa268934a8ed81c01fc65db5f800 (patch) | |
tree | e86aba58db59d7d67ecfab1b3e23859366c234b8 /src/cmd/go/internal/modload/edit.go | |
parent | 0e315ad79ae388eedb03dce27101c40b29292e2a (diff) | |
download | go-7dedc237c528fa268934a8ed81c01fc65db5f800.tar.gz go-7dedc237c528fa268934a8ed81c01fc65db5f800.zip |
cmd/go: smooth out upgrade paths for lazy loading
This change adds two possible upgrade paths for lazy loading:
1. Run 'go mod tidy -go=1.17'.
2. Starting in a module with no existing 'go' directive,
run any 'go' command that updates the go.mod file.
In the latter case, commands other than 'go mod tidy'
may leave the go.mod file *very* untidy if it had non-trivial
dependencies. (The 'go' invocation will promote all
implicit eager dependencies to explicit lazy ones,
which preserves the original module graph — most of which is
not actually relevant.)
'go mod tidy -go=1.17' can be used to enable lazy loading without
accidentally downgrading existing transitive dependencies.
'go mod tidy -go=1.16' can be used to disable lazy loading and clear
away redundant roots in a single step (if reducing the go version), or
to prune away dependencies of tests-of-external-tests (if increasing
the go version).
'go mod tidy -go=1.15' can be used to add dependencies of
tests-of-external-tests, although there isn't much point to that.
DO NOT MERGE
This change still needs an explicit test and a release note.
Fixes #45094
For #36460
Change-Id: I68f057e39489dfd6a667cd11dc1e320c1ee1aec1
Reviewed-on: https://go-review.googlesource.com/c/go/+/315210
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/cmd/go/internal/modload/edit.go')
-rw-r--r-- | src/cmd/go/internal/modload/edit.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/modload/edit.go b/src/cmd/go/internal/modload/edit.go index 2921b38157..c350b9d1b5 100644 --- a/src/cmd/go/internal/modload/edit.go +++ b/src/cmd/go/internal/modload/edit.go @@ -229,7 +229,7 @@ func raiseLimitsForUpgrades(ctx context.Context, maxVersion map[string]string, d if err != nil { return err } - if summary.depth() == eager { + if summary.depth == eager { // For efficiency, we'll load all of the eager upgrades as one big // graph, rather than loading the (potentially-overlapping) subgraph for // each upgrade individually. @@ -522,7 +522,7 @@ func (l *versionLimiter) check(m module.Version, depth modDepth) dqState { return l.disqualify(m, dqState{err: err}) } - if summary.depth() == eager { + if summary.depth == eager { depth = eager } for _, r := range summary.require { |