Skip to content

Commit

Permalink
Ignore purego build constraint (#1767)
Browse files Browse the repository at this point in the history
`purego` is a proposed[1] de-facto build constraint to
denote building _only_ Go code.

We must ignore this constraint to make sure that files
that toggle on `purego` are added to the Bazel target
`srcs` and let the compiler decide if they should be
compiled or not.

[1]: golang/go#23172
  • Loading branch information
mattyclarkson authored Mar 28, 2024
1 parent de6bd68 commit 457a76b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions language/go/build_constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ func matchAuto(tokens []string) (*buildTags, error) {
return newBuildTags(x)
}

// isIgnoredTag returns whether the tag is "cgo" or is a release tag.
// isIgnoredTag returns whether the tag is "cgo", "purego", "race", "msan" or is a release tag.
// Release tags match the pattern "go[0-9]\.[0-9]+".
// Gazelle won't consider whether an ignored tag is satisfied when evaluating
// build constraints for a file and will instead defer to the compiler at compile
// time.
func isIgnoredTag(tag string) bool {
if tag == "cgo" || tag == "race" || tag == "msan" {
if tag == "cgo" || tag == "purego" || tag == "race" || tag == "msan" {
return true
}
if len(tag) < 5 || !strings.HasPrefix(tag, "go") {
Expand Down

0 comments on commit 457a76b

Please sign in to comment.