]> Cypherpunks repositories - gostls13.git/commit
cmd/go: refactor modload.Import for better -mod=readonly errors
authorJay Conrod <jayconrod@google.com>
Wed, 9 Sep 2020 20:41:55 +0000 (16:41 -0400)
committerJay Conrod <jayconrod@google.com>
Fri, 11 Sep 2020 14:22:26 +0000 (14:22 +0000)
commit9214677e7df1e6130249bc83d721130b00d829c4
tree68f54fea4b32ad75f5f8196b95d14ab6dcdf47a2
parent6e3df749b1058ecfaf5f6601f6f8678c0971da8e
cmd/go: refactor modload.Import for better -mod=readonly errors

When -mod=readonly is set, Import will now allow imports from
replacements without explicit requirements. With -mod=mod, this would
add a new requirement but does not trigger a module lookup, so it's
determinisitic.

Before reporting an error for an unknown import with -mod=readonly,
check whether the import is valid. If there's a typo in the import,
that's more relevant.

For #40728

Change-Id: I05e138ff76ba3d0eb2e3010c15589fa363deb8d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/253745
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/modload/import.go
src/cmd/go/testdata/script/mod_build_info_err.txt