diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index 92dd7948715..3f679271111 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -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]) diff --git a/src/cmd/go/testdata/script/embed.txt b/src/cmd/go/testdata/script/embed.txt index 2ad799b7a7c..6ad42e9cd18 100644 --- a/src/cmd/go/testdata/script/embed.txt +++ b/src/cmd/go/testdata/script/embed.txt @@ -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$'