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 <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-08-22 10:57:17 -06:00
parent 4128f253e8
commit 7cb98d0557
+1 -29
View File
@@ -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