]> Cypherpunks.ru repositories - gostls13.git/commit
[release-branch.go1.20] cmd/go: save checksums for go.mod files needed for go version...
authorBryan C. Mills <bcmills@google.com>
Wed, 26 Apr 2023 05:43:20 +0000 (01:43 -0400)
committerMichael Knyszek <mknyszek@google.com>
Tue, 30 May 2023 16:25:12 +0000 (16:25 +0000)
commit4b95fc1e6cdd4a60e8eb7e460e26254e35396107
tree2d3c4490b9729aa0469aa0d0c8dee040aacf14f7
parent31a1e19a5981f63485ce5c56b0e783d1af278514
[release-branch.go1.20] cmd/go: save checksums for go.mod files needed for go version lines

When we load a package from a module, we need the go version line from
that module's go.mod file to know what language semantics to use for
the package. We need to save a checksum for the go.mod file even if
the module's requirements are pruned out of the module graph.
Previously, we were missing checksums for test dependencies of
packages in 'all' and packages passed to 'go get -t'.

This change preserves the existing bug for 'go mod tidy',
but fixes it for 'go get -t' and flags the missing checksum
with a clearer error in other cases.

Fixes #60001.
Updates #56222.

Change-Id: Icd6acce348907621ae0b02dbeac04fb180353dcf
(cherry picked from CL 489075 and CL 492741)
Reviewed-on: https://go-review.googlesource.com/c/go/+/493015
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
16 files changed:
src/cmd/go/internal/list/list.go
src/cmd/go/internal/modload/import.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/list_parse_err.txt
src/cmd/go/testdata/script/mod_install_pkg_version.txt
src/cmd/go/testdata/script/mod_list_sums.txt
src/cmd/go/testdata/script/mod_run_pkg_version.txt
src/cmd/go/testdata/script/mod_sum_issue56222.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_sum_readonly.txt
src/cmd/go/testdata/script/mod_tidy_compat.txt
src/cmd/go/testdata/script/mod_tidy_compat_ambiguous.txt
src/cmd/go/testdata/script/mod_tidy_compat_implicit.txt
src/cmd/go/testdata/script/mod_tidy_compat_incompatible.txt
src/cmd/go/testdata/script/mod_tidy_compat_irrelevant.txt