]> Cypherpunks repositories - gostls13.git/commit
cmd/go: print package import chains for some build list errors
authorJay Conrod <jayconrod@google.com>
Mon, 15 Apr 2019 19:34:49 +0000 (15:34 -0400)
committerJay Conrod <jayconrod@google.com>
Tue, 16 Apr 2019 18:50:43 +0000 (18:50 +0000)
commit2bdbc942f5ae3da8cad8d0f2bd3f4ce75a821e6c
tree8553aefca5a2194b5a5bd80666d8d50b3816353d
parentf7c967259254fa90e1f1951f83fb66850ae3809a
cmd/go: print package import chains for some build list errors

When we construct the build list by loading packages (e.g., in
"go build", "go list", or "go test"), we may load additional modules
not mentioned in the original build list. If we encounter an error
loading one of these modules, mvs.BuildList currently returns a
BuildListError with a chain of requirments. Unfortunately, this is not
helpful, since the graph is structured such that these missing modules
are direct requirements of the main module.

With this change, loader.load keeps track of the package that caused
each "missing" module to be added. If an error occurs in a missing
module, the chain of package imports is printed instead of the module
requirements.

Fixes #31475

Change-Id: Ie484814af42ceea3e85fedc38e705ba3a38cd495
Reviewed-on: https://go-review.googlesource.com/c/go/+/171859
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/modload/load.go
src/cmd/go/internal/mvs/mvs.go
src/cmd/go/testdata/script/mod_load_badchain.txt
src/cmd/go/testdata/script/mod_missingpkg_prerelease.txt