wrapcheck icon indicating copy to clipboard operation
wrapcheck copied to clipboard

Clarifiaction on internal custom errors

Open tombh opened this issue 1 year ago • 2 comments

First, thank you so much for this great linter. It's already brought me so much sanity, like a lost desert wanderer coming across an oasis 🏝️!

It seems that this doesn't, and indeed shouldn't, generate a lint message?

package main

import (
	"os"
	"github.com/pkg/errors"
)

var CustomError = errors.New("👷")

func main() {
	do()
}

func do() error {
	_, err := os.Open("/doesnt/exist")
	if err != nil {
		return CustomError
	}
	return nil
}

But my intuition from the proposition of this project is that it should. And it seems like that opinion is, or at least was, shared by others, judging by discussions in #3 and #6?

What's the current official position and reasoning? And are there any recommendations for helping ensure that return CustomError is wrapped?

tombh avatar May 13 '23 18:05 tombh