Skip to content

Commit

Permalink
buildutil: update tests for new "unix" build constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
charlievieth committed Aug 7, 2022
1 parent b7eed9c commit 0ef77b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions buildutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,19 @@ var goodOSArchFileTests = []goodOSArchFileTest{
tags: []string{"darwin", "arm64"},
match: false,
},
// TODO: for now the "unix" build constraint is not applied to file names
{
GOOS: "darwin",
GOARCH: "arm64",
filename: "syscall_unix.go",
match: true,
},
{
GOOS: "windows",
GOARCH: "amd64",
filename: "syscall_unix.go",
match: true,
},
}

func init() {
Expand Down
3 changes: 1 addition & 2 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import (
//
// An exception: if GOOS=android, then files with GOOS=linux are also matched.
func goodOSArchFile(ctxt *build.Context, name string, allTags map[string]bool) bool {
// TODO: check if name contains path elements?
name, _, _ = cut(name, ".")
name, _, _ = strings.Cut(name, ".")

// Before Go 1.4, a file called "linux.go" would be equivalent to having a
// build tag "linux" in that file. For Go 1.4 and beyond, we require this
Expand Down

0 comments on commit 0ef77b8

Please sign in to comment.