mirror of
https://github.com/golang/go
synced 2024-11-18 15:04:44 -07:00
oracle: ignore errors during import graph construction
Such errors include files without package decl, or conflicting package decls. We ignore type errors, so we should ignore import errors too. Fixes #10347 Change-Id: I9011a9099a2804281ea2d989d7263a9ce691be16 Reviewed-on: https://go-review.googlesource.com/8498 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
5cf8a6b1aa
commit
ab1b92fc43
@ -10,7 +10,6 @@ import (
|
||||
"go/ast"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"golang.org/x/tools/go/loader"
|
||||
@ -64,6 +63,9 @@ func referrers(q *Query) error {
|
||||
// If the identifier is exported, we must load all packages that
|
||||
// depend transitively upon the package that defines it.
|
||||
//
|
||||
// TODO(adonovan): we should do this for PkgName objects
|
||||
// too, even though they're lowercase.
|
||||
//
|
||||
// TODO(adonovan): opt: skip this step if obj.Pkg() is a test or
|
||||
// main package.
|
||||
if pass2 || !obj.Exported() {
|
||||
@ -71,13 +73,8 @@ func referrers(q *Query) error {
|
||||
}
|
||||
|
||||
// Scan the workspace and build the import graph.
|
||||
_, rev, errors := importgraph.Build(q.Build)
|
||||
if len(errors) > 0 {
|
||||
for path, err := range errors {
|
||||
fmt.Fprintf(os.Stderr, "Package %q: %s.\n", path, err)
|
||||
}
|
||||
return fmt.Errorf("failed to scan import graph for workspace")
|
||||
}
|
||||
// Ignore broken packages.
|
||||
_, rev, _ := importgraph.Build(q.Build)
|
||||
|
||||
// Re-load the larger program.
|
||||
// Create a new file set so that ...
|
||||
|
Loading…
Reference in New Issue
Block a user