Skip to content

modcmd: do not copy test embed files when vendoring #63497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cmd/go/internal/modcmd/vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func vendorPkg(vdir, pkg string) {
base.Fatalf("internal error: failed to find embedded files of %s: %v\n", pkg, err)
}
}
embedPatterns := str.StringList(bp.EmbedPatterns, bp.TestEmbedPatterns, bp.XTestEmbedPatterns)
embedPatterns := str.StringList(bp.EmbedPatterns)
embeds, err := load.ResolveEmbed(bp.Dir, embedPatterns)
if err != nil {
base.Fatal(err)
Expand Down
16 changes: 0 additions & 16 deletions src/cmd/go/testdata/script/mod_vendor_embed.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
go mod vendor
cmp vendor/example.com/a/samedir_embed.txt a/samedir_embed.txt
cmp vendor/example.com/a/subdir/embed.txt a/subdir/embed.txt
cmp vendor/example.com/a/subdir/test/embed.txt a/subdir/test/embed.txt
cmp vendor/example.com/a/subdir/test/xtest/embed.txt a/subdir/test/xtest/embed.txt

cd broken_no_matching_files
! go mod vendor
Expand Down Expand Up @@ -59,20 +57,6 @@ var subDir string
func Str() string {
return sameDir + subDir
}
-- a/a_test.go --
package a

import _ "embed"

//go:embed subdir/test/embed.txt
var subderTest string
-- a/a_x_test.go --
package a_test

import _ "embed"

//go:embed subdir/test/xtest/embed.txt
var subdirXtest string
-- a/samedir_embed.txt --
embedded file in same directory as package
-- a/subdir/embed.txt --
Expand Down