aboutsummaryrefslogtreecommitdiffhomepage
path: root/compileopts/config.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-12-30 20:58:10 +0100
committerRon Evans <[email protected]>2020-01-14 07:13:12 +0100
commit1a32a686745b6f001f5840ce11cf590324c24f2f (patch)
tree4e42dcb5c186c237c770f4a397d2b94625054690 /compileopts/config.go
parent9a69c6bcca23054f2acfe6ca89483546d5fc3e31 (diff)
downloadtinygo-1a32a686745b6f001f5840ce11cf590324c24f2f.tar.gz
tinygo-1a32a686745b6f001f5840ce11cf590324c24f2f.zip
compiler: add support for CGO_ENABLED environment variable
Diffstat (limited to 'compileopts/config.go')
-rw-r--r--compileopts/config.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/compileopts/config.go b/compileopts/config.go
index 197253e42..cbd0bd1d5 100644
--- a/compileopts/config.go
+++ b/compileopts/config.go
@@ -65,6 +65,12 @@ func (c *Config) BuildTags() []string {
return tags
}
+// CgoEnabled returns true if (and only if) CGo is enabled. It is true by
+// default and false if CGO_ENABLED is set to "0".
+func (c *Config) CgoEnabled() bool {
+ return goenv.Get("CGO_ENABLED") == "1"
+}
+
// GC returns the garbage collection strategy in use on this platform. Valid
// values are "none", "leaking", and "conservative".
func (c *Config) GC() string {