1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00

go/packages: trim errors returned by go list

go list sometimes sticks a leading newline in its error messages
have go/packages trim them until go list does the right thing

(of course, no one should depend on this behavior)

Fixes golang/go#32363

Change-Id: I6e145fb85bfc9d710c5f06146a64ec6919f59e36
Reviewed-on: https://go-review.googlesource.com/c/tools/+/183258
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
This commit is contained in:
Michael Matloob 2019-06-20 11:19:49 -04:00
parent 4adf7a708c
commit e0e20f22c0

View File

@ -699,7 +699,7 @@ func golistDriver(cfg *Config, words ...string) (*driverResponse, error) {
if p.Error != nil {
pkg.Errors = append(pkg.Errors, Error{
Pos: p.Error.Pos,
Msg: p.Error.Err,
Msg: strings.TrimSpace(p.Error.Err), // Trim to work around golang.org/issue/32363.
})
}