mirror of
https://github.com/golang/go
synced 2024-11-22 14:54:46 -07:00
cmd/go: set Incomplete field on go list output if no files match embed
If no files match the embed pattern, the Error field will be set on the package output by go list. Also set the Incomplete field for consistency. Fixes #43727 Change-Id: I5b4bb2a03a751269641a9bc4ef1d0fa0e37d46aa Reviewed-on: https://go-review.googlesource.com/c/go/+/284257 Trust: Michael Matloob <matloob@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
6e243ce71d
commit
803d18fc6c
@ -1809,6 +1809,7 @@ func (p *Package) load(ctx context.Context, path string, stk *ImportStack, impor
|
||||
|
||||
p.EmbedFiles, p.Internal.Embed, err = resolveEmbed(p.Dir, p.EmbedPatterns)
|
||||
if err != nil {
|
||||
p.Incomplete = true
|
||||
setError(err)
|
||||
embedErr := err.(*EmbedError)
|
||||
p.Error.setPos(p.Internal.Build.EmbedPatternPos[embedErr.Pattern])
|
||||
|
2
src/cmd/go/testdata/script/embed.txt
vendored
2
src/cmd/go/testdata/script/embed.txt
vendored
@ -46,6 +46,8 @@ stderr '^x.go:5:12: pattern [*]t: cannot embed directory t: contains no embeddab
|
||||
cp x.txt t/.git
|
||||
! go build -x
|
||||
stderr '^x.go:5:12: pattern [*]t: cannot embed directory t: contains no embeddable files$'
|
||||
go list -e -f '{{.Incomplete}}'
|
||||
stdout 'true'
|
||||
[symlink] symlink t/x.link -> ../x.txt
|
||||
[symlink] ! go build -x
|
||||
[symlink] stderr '^x.go:5:12: pattern [*]t: cannot embed directory t: contains no embeddable files$'
|
||||
|
Loading…
Reference in New Issue
Block a user