Skip to content

Commit

Permalink
refactor(options): remove redundant loop in WithIgnoreFields (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Braun <[email protected]>
  • Loading branch information
bluebrown authored Sep 2, 2023
1 parent ed006ca commit ed9508e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,7 @@ func WithConverter(fieldName string, fn ValidateConvertFunc) Option {
// (your Go struct) when parsing. Note: Field names are case sensitive.
func WithIgnoredFields(fieldName ...string) Option {
return func(o *options) error {
if len(fieldName) > 0 {
o.withIgnoredFields = make([]string, len(fieldName))
for _, name := range fieldName {
o.withIgnoredFields = append(o.withIgnoredFields, name)
}
o.withIgnoredFields = fieldName
}
o.withIgnoredFields = fieldName
return nil
}
}
Expand Down

0 comments on commit ed9508e

Please sign in to comment.