mirror of
https://github.com/etcd-io/etcd.git
synced 2026-02-05 06:46:49 +01:00
pkg/featuregate: Return MutableFeatureGate interface in New function
Avoid returning an unexported struct in the exported New function, instead return the MutableFeatureGate interface. Signed-off-by: Ivan Valdes <ivan@vald.es>
This commit is contained in:
@@ -166,7 +166,7 @@ func setUnsetBetaGates(known map[Feature]FeatureSpec, enabled map[Feature]bool,
|
||||
// Set, String, and Type implement pflag.Value
|
||||
var _ pflag.Value = &featureGate{}
|
||||
|
||||
func New(name string, lg *zap.Logger) *featureGate {
|
||||
func New(name string, lg *zap.Logger) MutableFeatureGate {
|
||||
if lg == nil {
|
||||
lg = zap.NewNop()
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ func TestFeatureGateFlag(t *testing.T) {
|
||||
t.Errorf("%d: Parse() Expected nil, Got %v", i, err)
|
||||
}
|
||||
for k, v := range test.expect {
|
||||
actual := f.enabled.Load().(map[Feature]bool)[k]
|
||||
actual := f.Enabled(k)
|
||||
assert.Equalf(t, actual, v, "%d: expected %s=%v, Got %v", i, k, v, actual)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user