]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: adjust pruning and switch toolchains if needed when go get changes go version
authorBryan C. Mills <bcmills@google.com>
Thu, 25 May 2023 21:07:26 +0000 (17:07 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 2 Jun 2023 23:07:08 +0000 (23:07 +0000)
commit77786d90fae21f526caaddd23c887a2a7233a299
treec781e5ff1abe4e259638e342ea7e00d5a374bf3f
parentc292a74c389aed9cab01d435a8f8cb4bfb087544
cmd/go: adjust pruning and switch toolchains if needed when go get changes go version

When we do 'go get', the Go version can change now.
That means we need to do the pruning conversions that
until now have only been necessary in go mod tidy -go=version.

We may also need to upgrade the toolchain in order to load enough o
the module graph to finish the edit, so we should let a TooNewError
bubble up to the caller instead of trying to downgrade the affected
module to avoid the error.

Revised from CL 498120.

For #57001.

Change-Id: Ic8994737eca4ed61ccc093a69e46f5a6caa8be87
Reviewed-on: https://go-review.googlesource.com/c/go/+/498267
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/go/internal/modget/get.go
src/cmd/go/internal/modload/buildlist.go
src/cmd/go/internal/modload/edit.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/load.go
src/cmd/go/internal/modload/modfile.go
src/cmd/go/testdata/script/mod_indirect_main.txt
src/cmd/go/testdata/script/mod_skip_write.txt
src/cmd/go/testdata/script/mod_tidy_version.txt
src/cmd/go/testdata/script/work_why_download_graph.txt