Skip to content

x/tools/go/analysis/passes/errorsas: support errors.As provided by other packages #44784

Open
golang/tools
#283
@ShoshinNikita

Description

@ShoshinNikita

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    AnalysisIssues related to static analysis (vet, x/tools/go/analysis)FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions