featureGate implements FeatureGate as well as pflag.Value for flag parsing.
| 127 | |
| 128 | // featureGate implements FeatureGate as well as pflag.Value for flag parsing. |
| 129 | type featureGate struct { |
| 130 | lg *zap.Logger |
| 131 | |
| 132 | featureGateName string |
| 133 | |
| 134 | special map[Feature]func(map[Feature]FeatureSpec, map[Feature]bool, bool) |
| 135 | |
| 136 | // lock guards writes to known, enabled, and reads/writes of closed |
| 137 | lock sync.Mutex |
| 138 | // known holds a map[Feature]FeatureSpec |
| 139 | known atomic.Value |
| 140 | // enabled holds a map[Feature]bool |
| 141 | enabled atomic.Value |
| 142 | // closed is set to true when AddFlag is called, and prevents subsequent calls to Add |
| 143 | closed bool |
| 144 | } |
| 145 | |
| 146 | func setUnsetAlphaGates(known map[Feature]FeatureSpec, enabled map[Feature]bool, val bool) { |
| 147 | for k, v := range known { |
nothing calls this directly
no outgoing calls
no test coverage detected