Otherwise given a file like defs_nacl_amd64p32.go.~1~ we will add
"nacl" and "amd64p32" to AllTags. This was causing the
cmd/go/internal/modindex tests to fail on my system, since I had
an old editor backup file lying around.
Change-Id: Ib1c5d835e4871addae6dc78cee07c9839bb880e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/446395
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
}
ext := name[i:]
- if !ctxt.goodOSArchFile(name, allTags) && !ctxt.UseAllFiles {
+ if ext != ".go" && fileListForExt(&dummyPkg, ext) == nil {
+ // skip
return nil, nil
}
- if ext != ".go" && fileListForExt(&dummyPkg, ext) == nil {
- // skip
+ if !ctxt.goodOSArchFile(name, allTags) && !ctxt.UseAllFiles {
return nil, nil
}
t.Errorf("GoFiles = %v, want %v", p.GoFiles, wantFiles)
}
}
+
+func TestAllTagsNonSourceFile(t *testing.T) {
+ p, err := Default.ImportDir("testdata/non_source_tags", 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(p.AllTags) > 0 {
+ t.Errorf("AllTags = %v, want empty", p.AllTags)
+ }
+}
--- /dev/null
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package non_source_tags
--- /dev/null
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package non_source_tags