terraform/vendor/github.com/mitchellh/gox/env_override.go

18 lines
374 B
Go
Raw Normal View History

2020-06-17 16:47:53 +02:00
package main
import (
"fmt"
"os"
"strings"
)
// envOverride overrides the given target based on if there is a
// env var in the format of GOX_{OS}_{ARCH}_{KEY}.
func envOverride(target *string, platform Platform, key string) {
key = strings.ToUpper(fmt.Sprintf(
"GOX_%s_%s_%s", platform.OS, platform.Arch, key))
if v := os.Getenv(key); v != "" {
*target = v
}
}