Open
Description
go/analysis/passes/errorsas
works only with the standard package errors
. So, I believe it is useless for many projects which use very popular github.com/pkg/errors
. Of course, it's possible to alias errors
package (for example stderrors
) and use it, but I think it's better to update the analyzer.
I see 2 options here:
- hard code
github.com/pkg/errors.As
. It's the simplest solution but requires an update for every new package - pass a list of functions via flags.
go/analysis/passes/printf
uses the similar approach
I think the best solution is to combine these options: use flags with the default functions errors.As
and github.com/pkg/errors.As