From a0407be7b7047c99871114ad9e4bfc6279502803 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Fri, 12 Aug 2022 14:39:43 +0200 Subject: [PATCH] goenv: support GOOS=android TinyGo doesn't currently support Android directly. However, GOOS=linux works fine on Android. Therefore, force GOOS=linux on Android. --- goenv/goenv.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/goenv/goenv.go b/goenv/goenv.go index 1e62eb35..d87f6f2e 100644 --- a/goenv/goenv.go +++ b/goenv/goenv.go @@ -42,10 +42,14 @@ var TINYGOROOT string func Get(name string) string { switch name { case "GOOS": - if dir := os.Getenv("GOOS"); dir != "" { - return dir + goos := os.Getenv("GOOS") + if goos == "" { + goos = runtime.GOOS } - return runtime.GOOS + if goos == "android" { + goos = "linux" + } + return goos case "GOARCH": if dir := os.Getenv("GOARCH"); dir != "" { return dir