MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / getStringValue

Function getStringValue

src/cmd/linuxkit/util.go:28–47  ·  view source on GitHub ↗
(envKey string, flagVal string, defaultVal string)

Source from the content-addressed store, hash-verified

26}
27
28func getStringValue(envKey string, flagVal string, defaultVal string) string {
29 var res string
30
31 // If defined, take the env variable
32 if _, ok := os.LookupEnv(envKey); ok {
33 res = os.Getenv(envKey)
34 }
35
36 // If a flag is specified, this value takes precedence
37 // Ignore cases where the flag carries the default value
38 if flagVal != "" && flagVal != defaultVal {
39 res = flagVal
40 }
41
42 // if we still don't have a value, use the default
43 if res == "" {
44 res = defaultVal
45 }
46 return res
47}
48
49func getIntValue(envKey string, flagVal int, defaultVal int) int {
50 var res int

Callers 9

pushGCPCmdFunction · 0.85
pushAWSCmdFunction · 0.85
pushEquinixMetalCmdFunction · 0.85
runEquinixMetalCmdFunction · 0.85
runAWSCmdFunction · 0.85
pushScalewayCmdFunction · 0.85
runScalewayCmdFunction · 0.85
runGCPCmdFunction · 0.85
runQEMUCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected