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

Function getBoolValue

src/cmd/linuxkit/util.go:74–103  ·  view source on GitHub ↗
(envKey string, flagVal bool)

Source from the content-addressed store, hash-verified

72}
73
74func getBoolValue(envKey string, flagVal bool) bool {
75 var res bool
76
77 // If defined, take the env variable
78 if _, ok := os.LookupEnv(envKey); ok {
79 switch os.Getenv(envKey) {
80 case "":
81 res = false
82 case "0":
83 res = false
84 case "false":
85 res = false
86 case "FALSE":
87 res = false
88 case "1":
89 res = true
90 default:
91 // catches "true", "TRUE" or anything else
92 res = true
93
94 }
95 }
96
97 // If a flag is specified, this value takes precedence
98 if res != flagVal {
99 res = flagVal
100 }
101
102 return res
103}
104
105func stringToIntArray(l string, sep string) ([]int, error) {
106 var err error

Callers 1

pushGCPCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected