Skip to content

Commit

Permalink
go/loader: improve robustness in face of input errors
Browse files Browse the repository at this point in the history
    Before this change, many kinds of error would cause the loader to stop.
    making it brittle when analyzing large codebases, as in "godoc -analysis".

    This change moves operations that used to occur during
    configuration---(*build.Context).Import, loading, and parsing of
    initial packages---into the Load call, and ensures that all failures
    during Loading are reported at the end so that the maximum amount of
    progress is made.

    Also: redesign the tests and add many new cases.

Change-Id: Ia8cd99416af7c5d4a5fe133908adfa83676d401f
Reviewed-on: https://go-review.googlesource.com/3626
Reviewed-by: Robert Griesemer <[email protected]>
  • Loading branch information
adonovan committed Feb 2, 2015
1 parent 7f3a9aa commit 0dda50d
Show file tree
Hide file tree
Showing 13 changed files with 485 additions and 243 deletions.
4 changes: 1 addition & 3 deletions cmd/eg/eg.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ func doMain() error {
}

// The first Created package is the template.
if err := conf.CreateFromFilenames("template", *templateFlag); err != nil {
return err // e.g. "foo.go:1: syntax error"
}
conf.CreateFromFilenames("template", *templateFlag)

if len(args) == 0 {
fmt.Fprint(os.Stderr, usage)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ssadump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func doMain() error {
}

if runtime.GOARCH != build.Default.GOARCH {
return fmt.Errorf("cross-interpretation is not yet supported (target has GOARCH %s, interpreter has %s)",
return fmt.Errorf("cross-interpretation is not supported (target has GOARCH %s, interpreter has %s)",
build.Default.GOARCH, runtime.GOARCH)
}

Expand Down
Loading

0 comments on commit 0dda50d

Please sign in to comment.