Skip to content

embedded ruleguard rule "externalErrorReassign" causes "panic: unreachable" #1253

@pierrre

Description

@pierrre

Original golangci-lint issue (all information is here): golangci/golangci-lint#3136

According to my log: golangci/golangci-lint#3136 (comment)
It's related to ruleguard: https://github.com/go-critic/go-critic/blob/v0.6.4/checkers/embedded_rules.go#L98

I've found the embedded rule that is causing the panic: externalErrorReassign

func externalErrorReassign(m dsl.Matcher) {
m.Match(`$pkg.$err = $x`).
Where(m["err"].Type.Is(`error`) && m["pkg"].Object.Is(`PkgName`)).
Report(`suspicious reassigment of error from another package`)
}

If I remove this rule ruleguard works well.

I can't try go-critic, because it embeds its own rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions