1
0
mirror of https://github.com/golang/go synced 2024-09-29 22:24:33 -06:00

cmd/go: fix review comments in load, modload

Follow-up to CL 255719, fixing review comments.

Change-Id: I26d3cc622496c3902c6924cf2b746c50705c4d50
Reviewed-on: https://go-review.googlesource.com/c/go/+/255937
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Jay Conrod 2020-09-18 08:33:44 -04:00
parent c47ba5fbfb
commit bf9800c793
2 changed files with 6 additions and 4 deletions

View File

@ -420,13 +420,16 @@ type ImportPathError interface {
ImportPath() string
}
var (
_ ImportPathError = (*importError)(nil)
_ ImportPathError = (*modload.ImportMissingError)(nil)
)
type importError struct {
importPath string
err error // created with fmt.Errorf
}
var _ ImportPathError = (*importError)(nil)
func ImportErrorf(path, format string, args ...interface{}) ImportPathError {
err := &importError{importPath: path, err: fmt.Errorf(format, args...)}
if errStr := err.Error(); !strings.Contains(errStr, path) {
@ -882,7 +885,7 @@ var preloadWorkerCount = runtime.GOMAXPROCS(0)
// because of global mutable state that cannot safely be read and written
// concurrently. In particular, packageDataCache may be cleared by "go get"
// in GOPATH mode, and modload.loaded (accessed via modload.Lookup) may be
// modified by modload.ImportPaths (modload.ImportPaths).
// modified by modload.ImportPaths.
type preload struct {
cancel chan struct{}
sema chan struct{}

View File

@ -209,7 +209,6 @@ func Init() {
}
cfg.ModulesEnabled = true
// load.ModDirImportPath = DirImportPath
if modRoot == "" {
// We're in module mode, but not inside a module.