diff --git a/altsrc/flag.go b/altsrc/flag.go index 680288ca48..d252aba16a 100644 --- a/altsrc/flag.go +++ b/altsrc/flag.go @@ -116,9 +116,7 @@ func (f *StringSliceFlag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSour } } if f.Destination != nil { - if err := f.Destination.Set(sliceValue.Serialize()); err != nil { - return err - } + _ = f.Destination.Set(sliceValue.Serialize()) } } return nil diff --git a/altsrc/flag_test.go b/altsrc/flag_test.go index 9341ff2f24..c41d6dbca2 100644 --- a/altsrc/flag_test.go +++ b/altsrc/flag_test.go @@ -65,6 +65,24 @@ func TestGenericApplyInputSourceValue(t *testing.T) { refute(t, v, c.Generic("test")) } +func TestGenericApplyInputSourceValueError(t *testing.T) { + set := flag.NewFlagSet("", flag.ContinueOnError) + c := cli.NewContext(nil, set, nil) + + testFlag := &GenericFlag{ + GenericFlag: &cli.GenericFlag{ + Name: "test", + Value: &cli.StringSlice{}, + }, + set: set, + } + + err := testFlag.ApplyInputSourceValue(c, NewMapInputSource("", map[interface{}]interface{}{ + "test": testFlag.Value, + })) + expect(t, err, fmt.Errorf("no such flag -test")) +} + func TestGenericApplyInputSourceMethodContextSet(t *testing.T) { p := &Parser{"abc", "def"} tis := testApplyInputSource{