Skip to content

Commit 0db2501

Browse files
dmitshurgopherbot
authored andcommitted
internal/copyright: skip testdata and vendor directories only
Using filepath.SkipDir without confirming that d is a directory makes it prone to taking unintended action if a file (not a directory) with the same name gets added. This isn't a problem today, but we shouldn't spend human code review time checking that this doesn't somehow happen in the future, either. Change-Id: I29bf203ddef175c3ad23c9ddc10fa934126ac853 Reviewed-on: https://go-review.googlesource.com/c/go/+/630635 Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Bypass: Dmitri Shuralyov <[email protected]>
1 parent dc8ceb6 commit 0db2501

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/internal/copyright/copyright_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var permitted = [][]byte{
3434
func TestCopyright(t *testing.T) {
3535
buf := make([]byte, 2048)
3636
filepath.WalkDir(filepath.Join(testenv.GOROOT(t), "src"), func(path string, d fs.DirEntry, err error) error {
37-
if d.Name() == "testdata" || d.Name() == "vendor" {
37+
if d.IsDir() && (d.Name() == "testdata" || d.Name() == "vendor") {
3838
return filepath.SkipDir
3939
}
4040
switch filepath.Ext(d.Name()) {

0 commit comments

Comments
 (0)