fyne-io/fyne · error
unknown GOARCH: %q
Error message
unknown GOARCH: %q
What it means
While preparing the clang environment for iOS/iosimulator targets, the vendored mobile tool iterates every architecture in the target list and maps it to an Xcode SDK. Only arm (GOARM=7), arm64, 386 and amd64 (both simulator) are handled; any other GOARCH reaches the default branch and panics.
Source
Thrown at cmd/fyne/internal/mobile/env.go:201
var err error
var clang, cflags string
switch arch {
case "arm":
env = append(env, "GOARM=7")
fallthrough
case "arm64":
if buildTarget == "ios" {
clang, cflags, err = envClang("iphoneos")
cflags += " -miphoneos-version-min=" + buildIOSVersion
} else { // iossimulator
clang, cflags, err = envClang("iphonesimulator")
cflags += " -mios-simulator-version-min=" + buildIOSVersion
}
case "386", "amd64":
clang, cflags, err = envClang("iphonesimulator")
cflags += " -mios-simulator-version-min=" + buildIOSVersion
default:
panic(fmt.Errorf("unknown GOARCH: %q", arch))
}
if err != nil {
return err
}
if bitcodeEnabled {
cflags += " -fembed-bitcode"
}
os := "ios"
if before116 {
os = "darwin"
}
env = append(
env,
"GOOS="+os,
"GOARCH="+arch,
"CC="+clang,View on GitHub (pinned to 8860ee95c3)
Solutions
- Use supported targets: plain ios (arm64+arm) or iossimulator (amd64/386); drop the unsupported arch from -target
- Run 'unset GOARCH GOARM GOOS' before 'fyne package' so a leaked environment variable cannot poison the target
- Update fyne - architectures are added to the supported set as Xcode gains them
Example fix
# before fyne package -os ios -target ios/riscv64 # after fyne package -os ios
Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight: validate the -target architecture list before invoking the packaging tool.
var supportedIOSArchs = map[string]bool{"arm": true, "arm64": true, "386": true, "amd64": true}
func validTarget(archs []string) error {
for _, a := range archs {
if !supportedIOSArchs[a] { return fmt.Errorf("unsupported target arch %q; use ios or iossimulator defaults", a) }
}
return nil
} Prevention
- Run 'unset GOARCH GOARM GOOS' in build scripts before calling fyne
- Use '-os ios' / '-os iossimulator' without explicit arch lists unless you must pin one
- Print the effective target list at the top of CI logs so bad values are visible
When it happens
Trigger: Packaging for an Apple target with an architecture outside {arm, arm64, 386, amd64} in the list, e.g. 'fyne package -os ios -target ios/riscv64', or a GOARCH value leaked into the environment when custom tooling reuses this code path.
Common situations: A stale exported GOARCH in the shell/CI session; typo'd -target values; building for a new architecture before the vendored tool supports it.
Related errors
- unhandled token type: %T %+v
- unsupported GOARCH:
- out of touchIDs
- encountered empty values slice
- TODO only know how to handle DataIntDec type here
AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15).
Data as JSON: /api/errors/d9def59ca144cb7d.
Report an issue: GitHub.