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
+6
View File
@@ -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 {