Skip to content

Commit

Permalink
mksysconf: allow to override GO{ARCH,OS} using GO{OS,ARCH}_TARGET env…
Browse files Browse the repository at this point in the history
… vars

Makes it easier to test change.
  • Loading branch information
tklauser committed Sep 26, 2024
1 parent 4f2b20a commit 3011bd3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions mksysconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,18 @@ func gensysconf(in, out, goos, goarch string) error {
}

func main() {
goos, goarch := runtime.GOOS, runtime.GOARCH
if goos == "illumos" {
goos = "solaris"
goos := os.Getenv("GOOS_TARGET")
if goos == "" {
goos = runtime.GOOS
if goos == "illumos" {
goos = "solaris"
}
}
goarch := os.Getenv("GOARCH_TARGET")
if goarch == "" {
goarch = runtime.GOARCH
}

defs := fmt.Sprintf("sysconf_defs_%s.go", goos)
if err := gensysconf(defs, "z"+defs, goos, ""); err != nil {
fmt.Fprintln(os.Stderr, err)
Expand Down

0 comments on commit 3011bd3

Please sign in to comment.