tomarrell / wrapcheck

A Go linter to check that errors from external packages are wrapped
https://blog.tomarrell.com/post/introducing_wrapcheck_linter_for_go
MIT License
291 stars 26 forks source link

False positive when return errors.New() #42

Closed ks16 closed 1 year ago

ks16 commented 1 year ago

I have a function that returns a new error:

func (s SomeType) Validate() error {
    if s.Id == 0 {
        return errors.New("validation: id is required")
    }

        return nil
}

When I run golangci-lint with wrapckeck enabled I have an error: error returned from external package is unwrapped: sig: func errors.New(text string) error (wrapcheck)