From 7cb98d0557e75b6f2c71cd5c091dcc71a6e7b965 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 22 Aug 2023 10:57:17 -0600 Subject: [PATCH] gogio: remove fallback for missing GOOS=ios support in Go <= 1.15 Go 1.16 is already old, and the GOOS detection code fails for me on Nix: $ go run gioui.org/cmd/gogio -target ios ../gio-example/kitchen gogio: go tool dist list failed: go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT The error message points to a Nix packaging issue, but removing the fallback is easier to fix. Signed-off-by: Elias Naur --- gogio/iosbuild.go | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/gogio/iosbuild.go b/gogio/iosbuild.go index c3b596a..f875fce 100644 --- a/gogio/iosbuild.go +++ b/gogio/iosbuild.go @@ -423,16 +423,6 @@ func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error { lipo := exec.Command("xcrun", "lipo", "-o", exe, "-create") var builds errgroup.Group tags := bi.tags - goos := "ios" - supportsIOS, err := supportsGOOS("ios") - if err != nil { - return err - } - if !supportsIOS { - // Go 1.15 and earlier target iOS with GOOS=darwin, tags=ios. - goos = "darwin" - tags = "ios " + tags - } for _, a := range bi.archs { clang, cflags, err := iosCompilerFor(target, a, bi.minsdk) if err != nil { @@ -452,7 +442,7 @@ func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error { cflagsLine := strings.Join(cflags, " ") cmd.Env = append( os.Environ(), - "GOOS="+goos, + "GOOS=ios", "GOARCH="+a, "CGO_ENABLED=1", "CC="+clang, @@ -488,24 +478,6 @@ func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error { return ioutil.WriteFile(moduleFile, []byte(module), 0644) } -func supportsGOOS(wantGoos string) (bool, error) { - geese, err := runCmd(exec.Command("go", "tool", "dist", "list")) - if err != nil { - return false, err - } - for _, pair := range strings.Split(geese, "\n") { - s := strings.SplitN(pair, "/", 2) - if len(s) != 2 { - return false, fmt.Errorf("go tool dist list: invalid GOOS/GOARCH pair: %s", pair) - } - goos := s[0] - if goos == wantGoos { - return true, nil - } - } - return false, nil -} - func iosCompilerFor(target, arch string, minsdk int) (string, []string, error) { var ( platformSDK string