]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.16] 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:35 +0000 (21:25 +0000)
commit6e041884406421d329b9c6064f3c13104628c876
treecf05d317c69cd866d4b197ae3593a0be5d9751c7
parentb5c1b5aa070b6c0d7c9d38637d0e0d298bee52c0
[release-branch.go1.16] 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.

Fixes #44793
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/+/298949
src/cmd/go/internal/modcmd/tidy.go
src/cmd/go/internal/modcmd/vendor.go
src/cmd/go/internal/modload/load.go
src/cmd/go/testdata/script/mod_tidy_error.txt