compiler: add support for CGO_ENABLED environment variable

This commit is contained in:
Ayke van Laethem
2019-12-30 20:58:10 +01:00
committed by Ron Evans
parent 9a69c6bcca
commit 1a32a68674
3 changed files with 16 additions and 2 deletions
+8
View File
@@ -18,6 +18,7 @@ var Keys = []string{
"GOROOT",
"GOPATH",
"GOCACHE",
"CGO_ENABLED",
"TINYGOROOT",
}
@@ -57,6 +58,13 @@ func Get(name string) string {
panic("could not find cache dir: " + err.Error())
}
return filepath.Join(dir, "tinygo")
case "CGO_ENABLED":
val := os.Getenv("CGO_ENABLED")
if val == "1" || val == "0" {
return val
}
// Default to enabling CGo.
return "1"
case "TINYGOROOT":
return sourceDir()
default: