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
302 stars 27 forks source link

False-positive for anonymous functions #17

Open r2k1 opened 3 years ago

r2k1 commented 3 years ago

Wrapcheck throws an error for the next case:

import "errors"

func Test_AnonFunc(t *testing.T) {
    test := func() error {
        return errors.New("test")
    }
    fmt.Println(test())
}

error returned from external package is unwrapped: sig: func errors.New(text string) error

tomarrell commented 3 years ago

Thanks for the report. Will have a look when I get some time.

hsommerlandreason commented 1 year ago

Bump on this. it is driving me a bit crazy.