mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 16:33:40 +00:00
compiler: add support for CGO_ENABLED environment variable
This commit is contained in:
committed by
Ron Evans
parent
9a69c6bcca
commit
1a32a68674
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user