Skip to content

Commit

Permalink
Remove Unnecessary Error from pflag
Browse files Browse the repository at this point in the history
Pflag has types for all the integer sizes so we don't need to check for
overflowing and thus this code that was inherited from the flag package
is unnecessary.
  • Loading branch information
sergiosalvatore committed Aug 30, 2024
1 parent 2e8ffb1 commit ba6d740
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions sources/pflag/pflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,7 @@ func (s *Set) Value(_ context.Context, t *dials.Type) (reflect.Value, error) {
return reflect.Value{}, err
}
}
var setErr error
val := reflect.New(t.Type())

s.Flags.Visit(func(f *pflag.Flag) {
fieldName, ok := s.flagFieldName[f.Name]
if !ok {
Expand Down Expand Up @@ -492,9 +491,6 @@ func (s *Set) Value(_ context.Context, t *dials.Type) (reflect.Value, error) {
ffield.Set(cfval)
}
})
if setErr != nil {
return val.Elem(), setErr
}

return s.tfmr.ReverseTranslate(s.trnslVal)
}
Expand Down

0 comments on commit ba6d740

Please sign in to comment.