]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: don't fetch files missing sums in readonly mode
authorJay Conrod <jayconrod@google.com>
Tue, 13 Oct 2020 22:19:21 +0000 (18:19 -0400)
committerJay Conrod <jayconrod@google.com>
Fri, 23 Oct 2020 20:54:30 +0000 (20:54 +0000)
commit5cd4390f3853b8d0d2d962f7acdac87c0eba3d77
tree52079404d9c5b294a88c8bfe5ff5b0cc56d581ad
parent5f616a6fe789622f3e0ed0e8a00db9471e2a02f4
cmd/go: don't fetch files missing sums in readonly mode

If the go command needs a .mod or .zip file in -mod=readonly mode
(now the default), and that file doesn't have a hash in the main
module's go.sum file, the go command will now report an error before
fetching the file, rather than at the end when failing to update
go.sum. The error says specifically which entry is missing.

If this error is encountered when loading the build list, it will
suggest 'go mod tidy'.

If this error is encountered when loading a specific package (an
import or command line argument), the error will mention that package
and will suggest 'go mod tidy' or 'go get -d'.

Fixes #41934
Fixes #41935

Change-Id: I96ec2ef9258bd4bade9915c43d47e6243c376a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/262341
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
14 files changed:
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/modfetch/fetch.go
src/cmd/go/internal/modload/import.go
src/cmd/go/internal/modload/load.go
src/cmd/go/internal/modload/modfile.go
src/cmd/go/internal/modload/query.go
src/cmd/go/internal/modload/search.go
src/cmd/go/testdata/script/mod_install_pkg_version.txt
src/cmd/go/testdata/script/mod_load_badchain.txt
src/cmd/go/testdata/script/mod_load_replace_mismatch.txt
src/cmd/go/testdata/script/mod_readonly.txt
src/cmd/go/testdata/script/mod_sum_readonly.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_sumdb.txt
src/cmd/go/testdata/script/sum_readonly.txt [deleted file]