wrapcheck icon indicating copy to clipboard operation
wrapcheck copied to clipboard

Support Gorm-style error checking

Open cdignam-segment opened this issue 2 years ago • 3 comments

Gorm uses non-standard error format to support it's chainable API. It would be nice if there was a way to configure wrapcheck to match a *.\.Error regex

tx := tx.Find(&customer)
if tx.Error != nil {
    return nil, tx.Error // wrapcheck should warn here
}


abc := tx.Find(&customer)
if abc.Error != nil {
    return nil, abc.Error // wrapcheck should warn here
}

cdignam-segment avatar Jun 24 '22 16:06 cdignam-segment

That should be possible, will just need a bit of a tweak to the AST matcher. I'll take a look when I get some time. If you want it sooner, I'm happy to review a PR.

tomarrell avatar Aug 31 '22 13:08 tomarrell

@tomarrell any update on this? I would love to have support for Gorm

davideme avatar May 09 '24 14:05 davideme