Skip to content

Commit ee9c339

Browse files
committed
Log valid feature gates on error
1 parent e116f8c commit ee9c339

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

featuregate/registry.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ func (r *Registry) Register(id string, stage Stage, opts ...RegisterOption) (*Ga
109109
func (r *Registry) Set(id string, enabled bool) error {
110110
v, ok := r.gates.Load(id)
111111
if !ok {
112-
return fmt.Errorf("no such feature gate %q", id)
112+
validGates := []string{}
113+
r.VisitAll(func(g *Gate) {
114+
validGates = append(validGates, g.ID())
115+
})
116+
return fmt.Errorf("no such feature gate %q. valid gates: %v", id, validGates)
113117
}
114118
g := v.(*Gate)
115119

0 commit comments

Comments
 (0)