MCPcopy
hub / github.com/kubernetes/kops / new

Function new

pkg/featureflag/featureflag.go:120–137  ·  view source on GitHub ↗

new creates a new feature flag

(key string, defaultValue *bool)

Source from the content-addressed store, hash-verified

118
119// new creates a new feature flag
120func new(key string, defaultValue *bool) *FeatureFlag {
121 flagsMutex.Lock()
122 defer flagsMutex.Unlock()
123
124 f := flags[key]
125 if f == nil {
126 f = &FeatureFlag{
127 Key: key,
128 }
129 flags[key] = f
130 }
131
132 if f.defaultValue == nil {
133 f.defaultValue = defaultValue
134 }
135
136 return f
137}
138
139// Enabled checks if the flag is enabled
140func (f *FeatureFlag) Enabled() bool {

Callers 15

WriteSpanMethod · 0.85
CloseMethod · 0.85
CloseAndRecvMethod · 0.85
RecvMethod · 0.85
RecvMethod · 0.85
GetServicesMethod · 0.85
GetOperationsMethod · 0.85
RecvMethod · 0.85
FindTraceIDsMethod · 0.85

Calls 2

LockMethod · 0.65
UnlockMethod · 0.65

Tested by 3

TestFlagToFalseFunction · 0.68
TestSetenvFunction · 0.68