Skip to content

Commit

Permalink
having a nil deprecation is not an invalid value
Browse files Browse the repository at this point in the history
(Deprecation, error) looks like a result-error pair to the linter, when it's
actually two classes of errors, one soft and one hard.
  • Loading branch information
hugowetterberg committed May 29, 2024
1 parent 1697a94 commit f7a6967
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions string_constraint.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ func (sc *StringConstraint) Validate(
) (*Deprecation, error) {
if !exists {
if sc.Optional {
return nil, nil
return nil, nil //nolint: nilnil
}

return nil, errors.New("required value")
}

if sc.AllowEmpty && value == "" {
return nil, nil
return nil, nil //nolint: nilnil
}

if sc.Const != nil && value != *sc.Const {
Expand Down

0 comments on commit f7a6967

Please sign in to comment.