Skip to content

Commit

Permalink
fix: native build of syscalls on android and illumos
Browse files Browse the repository at this point in the history
As per https://golang.org/cmd/go/#hdr-Build_constraints,
using GOOS=android also matches tags and files for GOOS=linux,
so exclude it explicetly to avoid collisions.

Also using GOOS=illumos matches tags and files for GOOS=solaris.

Fixes #843.
  • Loading branch information
mvertes committed Sep 14, 2020
1 parent a2f5643 commit 1edb6a1
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 10 deletions.
13 changes: 13 additions & 0 deletions extract/extract.go
Expand Up @@ -216,6 +216,19 @@ func genContent(dest, importPath, license string, p *types.Package, skip map[str
buildTags += ",!windows,!nacl,!plan9"
}

if importPath == "syscall" {
// As per https://golang.org/cmd/go/#hdr-Build_constraints,
// using GOOS=android also matches tags and files for GOOS=linux,
// so exclude it explicitly to avoid collisions (issue #843).
// Also using GOOS=illumos matches tags and files for GOOS=solaris.
switch os.Getenv("GOOS") {
case "android":
buildTags += ",!linux"
case "illumos":
buildTags += ",!solaris"
}
}

b := new(bytes.Buffer)
data := map[string]interface{}{
"Dest": dest,
Expand Down
1 change: 1 addition & 0 deletions interp/build.go
Expand Up @@ -162,6 +162,7 @@ var knownOs = map[string]bool{
"darwin": true,
"dragonfly": true,
"freebsd": true,
"illumos": true,
"js": true,
"linux": true,
"nacl": true,
Expand Down
2 changes: 1 addition & 1 deletion stdlib/syscall/go1_14_syscall_android_386.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_14_syscall_android_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_14_syscall_android_arm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_14_syscall_android_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_14_syscall_illumos_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_15_syscall_android_386.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_15_syscall_android_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_15_syscall_android_arm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_15_syscall_android_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stdlib/syscall/go1_15_syscall_illumos_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1edb6a1

Please sign in to comment.