go.tools/go/loader: make error message for massive failure (e.g. no "fmt") more concise.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/126080043
This commit is contained in:
Alan Donovan 2014-08-14 12:10:34 -04:00
parent c98886f21f
commit f13ba78920
1 changed files with 7 additions and 2 deletions

View File

@ -604,8 +604,13 @@ func (conf *Config) Load() (*Program, error) {
} }
} }
if errpkgs != nil { if errpkgs != nil {
return nil, fmt.Errorf("couldn't load packages due to errors: %s", var more string
strings.Join(errpkgs, ", ")) if len(errpkgs) > 3 {
more = fmt.Sprintf(" and %d more", len(errpkgs)-3)
errpkgs = errpkgs[:3]
}
return nil, fmt.Errorf("couldn't load packages due to errors: %s%s",
strings.Join(errpkgs, ", "), more)
} }
} }