1
0
mirror of https://github.com/golang/go synced 2024-11-26 23:51:29 -07:00

cmd/go/internal/work: set Incomplete to true if there is an error

Fixes #57724

Change-Id: I3d419985ff41d5ee93bb56d8c7ca5cd1d7231920
Reviewed-on: https://go-review.googlesource.com/c/go/+/536418
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Quan Tong 2023-10-19 11:44:32 +07:00 committed by Gopher Robot
parent 2968f5623c
commit c75a617af0
2 changed files with 5 additions and 0 deletions

View File

@ -164,6 +164,7 @@ func (b *Builder) Do(ctx context.Context, root *Action) {
if b.AllowErrors && a.Package != nil {
if a.Package.Error == nil {
a.Package.Error = &load.PackageError{Err: err}
a.Package.Incomplete = true
}
} else {
var ipe load.ImportPathError

View File

@ -6,6 +6,10 @@ go list -f '{{with .Error}}{{.}}{{end}}' -e -export ./...
! stderr '.'
stdout '^# example.com/p2\np2'${/}'main\.go:7:.*'
go list -export -e -f '{{.ImportPath}} -- {{.Incomplete}} -- {{.Error}}' ./...
stdout 'example.com/p1 -- false -- <nil>'
stdout 'example.com/p2 -- true -- # example.com/p2'
go list -e -export -json=Error ./...
stdout '"Err": "# example.com/p2'