Skip to content

Commit

Permalink
internal/language/go: ignore "race" and "msan" tags (#244)
Browse files Browse the repository at this point in the history
"race" and "msan" may or may not be enabled, and the compile builder
will filter these sources appropriately. We should ignore these tags,
just like we ignore cgo and release tags.

Fixes #233
  • Loading branch information
jayconrod authored Jun 25, 2018
1 parent 43a04bc commit a871ca8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/language/go/fileinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func checkConstraints(c *config.Config, os, arch, osSuffix, archSuffix string, f
// Gazelle won't consider whether an ignored tag is satisfied when evaluating
// build constraints for a file.
func isIgnoredTag(tag string) bool {
if tag == "cgo" {
if tag == "cgo" || tag == "race" || tag == "msan" {
return true
}
if len(tag) < 5 || !strings.HasPrefix(tag, "go") {
Expand Down
8 changes: 8 additions & 0 deletions internal/language/go/fileinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ import "C"
desc: "cgo tag negated",
content: "// +build !cgo",
want: true,
}, {
desc: "race msan tags",
content: "// +build msan race",
want: true,
}, {
desc: "race msan tags negated",
content: "//+ build !msan,!race",
want: true,
},
} {
t.Run(tc.desc, func(t *testing.T) {
Expand Down

0 comments on commit a871ca8

Please sign in to comment.