Skip to content

Commit

Permalink
allow empty featuregate values
Browse files Browse the repository at this point in the history
  • Loading branch information
matianjun1 committed Jul 10, 2022
1 parent 58e66af commit 8632ba6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions service/featuregate/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (f FlagValue) String() string {

// Set applies the FlagValue encoded in the input string
func (f FlagValue) Set(s string) error {
if s == "" {
return nil
}

return f.setSlice(strings.Split(s, ","))
}

Expand Down
5 changes: 5 additions & 0 deletions service/featuregate/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func TestFlagValue_basic(t *testing.T) {
output FlagValue
skipString bool
}{
{
name: "empty item",
input: "",
output: FlagValue{},
},
{
name: "single item",
input: "foo",
Expand Down

0 comments on commit 8632ba6

Please sign in to comment.