]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modload: track conflicts in versionLimiter
authorBryan C. Mills <bcmills@google.com>
Fri, 26 Mar 2021 04:44:30 +0000 (00:44 -0400)
committerBryan C. Mills <bcmills@google.com>
Tue, 6 Apr 2021 21:25:55 +0000 (21:25 +0000)
commit0bc4605eadc53f19e75b232422c7af0ad707d6c6
treecf5d88001e076bf0dd55fec6abb369815cf2ddca
parentb56177a3037a035ee7f74e619838b6d853697100
cmd/go/internal/modload: track conflicts in versionLimiter

This significantly simplifies the implementation of editRequirements
in preparation for making it lazy. It should have no effect on which
version combinations are rejected by 'go get', nor on which solutions
are found if downgrades are needed.

This change results in a small but observable change in error logging.
Before, we were reporting an error line for each argument that would
have exceeded its specified version, attributing it to one arbitrary
cause. Now, we are reporting an error line for each argument that
would cause any other argument to exceed its specified version. As a
result, if one argument would cause two others to exceed their
versions, we will now report one line instead of two; if two arguments
would independently cause one other to exceed its version, we will now
report two lines instead of one.

This change may result in a small performance improvement. Because we
are now scanning and rejecting incompatible requirements earlier, we
may waste less time computing upgrades and downgrades that ultimately
won't matter due to conflicting constraints.

For #36460

Change-Id: I125aa09b4be749dc5bacef23a859333991960e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/305009
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/modload/buildlist.go
src/cmd/go/internal/modload/edit.go
src/cmd/go/testdata/script/mod_get_downgrade.txt