]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.15] cmd/go: don't report missing std import errors for tidy and...
authorJay Conrod <jayconrod@google.com>
Thu, 4 Mar 2021 16:50:31 +0000 (11:50 -0500)
committerAlexander Rakoczy <alex@golang.org>
Wed, 10 Mar 2021 21:25:28 +0000 (21:25 +0000)
commitba3dc70dc5c9f2162024b09d6b13bda1f4575b01
tree74fda72900e8c1aa57258ab470ef7b9d48d77046
parentff7e6383183ff5bdd95257c0ad7db3cd96619d7f
[release-branch.go1.15] cmd/go: don't report missing std import errors for tidy and vendor

'go mod tidy' and 'go mod vendor' normally report errors when a
package can't be imported, even if the import appears in a file that
wouldn't be compiled by the current version of Go. These errors are
common for packages introduced in higher versions of Go, like "embed"
in 1.16.

This change causes 'go mod tidy' and 'go mod vendor' to ignore
missing package errors if the import path appears to come from the
standard library because it lacks a dot in the first path element.

NOTE: This change is not a clean cherry-pick of CL 298749 because
parts of modload were substantially rewritten after 1.15.

Fixes #44792
Updates #27063

Change-Id: I61d6443e77ab95fd8c0d1514f57ef4c8885a77cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/298749
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
(cherry picked from commit 56d52e661114be60fb1893b034ac0c5976b622af)
Reviewed-on: https://go-review.googlesource.com/c/go/+/298950
src/cmd/go/internal/modcmd/tidy.go
src/cmd/go/internal/modcmd/vendor.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/load.go
src/cmd/go/testdata/script/mod_tidy_error.txt