Files
codeql/extractor/util/util.go
Max Schaefer 510b6070c9 Introduce official environment variable for goroutine limiting.
We've had to tell people how to do this, so we should have a name for it that doesn't refer to a defunct company.
2020-04-02 10:45:52 +01:00

21 lines
472 B
Go

package util
import "os"
// Getenv retrieves the value of the environment variable named by the key.
// If that variable is not present, it iterates over the given aliases until
// it finds one that is. If none are present, the empty string is returned.
func Getenv(key string, aliases ...string) string {
val := os.Getenv(key)
if val != "" {
return val
}
for _, alias := range aliases {
val = os.Getenv(alias)
if val != "" {
return val
}
}
return ""
}