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>
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])
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$'