aboutsummaryrefslogtreecommitdiffhomepage
path: root/goenv/goenv.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-08-12 14:39:43 +0200
committerRon Evans <[email protected]>2022-08-13 12:43:38 +0200
commita0407be7b7047c99871114ad9e4bfc6279502803 (patch)
treea8dba2bf72cc44fc01f682105fa04b7e96861b84 /goenv/goenv.go
parente70dfa4dd6c5c1ab779e3fc2a3bfc6f3e8b74c88 (diff)
downloadtinygo-a0407be7b7047c99871114ad9e4bfc6279502803.tar.gz
tinygo-a0407be7b7047c99871114ad9e4bfc6279502803.zip
goenv: support GOOS=android
TinyGo doesn't currently support Android directly. However, GOOS=linux works fine on Android. Therefore, force GOOS=linux on Android.
Diffstat (limited to 'goenv/goenv.go')
-rw-r--r--goenv/goenv.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/goenv/goenv.go b/goenv/goenv.go
index 1e62eb35b..d87f6f2e9 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
+ }
+ if goos == "android" {
+ goos = "linux"
}
- return runtime.GOOS
+ return goos
case "GOARCH":
if dir := os.Getenv("GOARCH"); dir != "" {
return dir