mirror of
https://github.com/golang/go
synced 2024-11-18 19:44:46 -07:00
go/packages: ignore Cgo compilation error correctly
Before this change, Cgo error was ignored only when the number of the error message lines was exactly 2. There are many environments where that condition did not work well. This CL removes this condition. This is not a perfect solution because the error message can include other message than Cgo. However, this should work in most cases. Updates golang/go#33462 Fixes golang/go#33859 Change-Id: I606fb9eab3cd1e73b88ac1add1a82aff53f36708 Reviewed-on: https://go-review.googlesource.com/c/tools/+/191942 Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
d151469ab0
commit
f4d8977246
@ -886,7 +886,9 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) {
|
|||||||
|
|
||||||
// Is there an error running the C compiler in cgo? This will be reported in the "Error" field
|
// Is there an error running the C compiler in cgo? This will be reported in the "Error" field
|
||||||
// and should be suppressed by go list -e.
|
// and should be suppressed by go list -e.
|
||||||
if len(stderr.String()) > 0 && strings.HasPrefix(stderr.String(), "# runtime/cgo\n") && strings.Count(stderr.String(), "\n") == 2 {
|
//
|
||||||
|
// This condition is not perfect yet because the error message can include other error messages than runtime/cgo.
|
||||||
|
if len(stderr.String()) > 0 && strings.HasPrefix(stderr.String(), "# runtime/cgo\n") {
|
||||||
return stdout, nil
|
return stdout, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user