polyfloyd / go-errorlint

A source code linter that can be used to find code that will cause problems with Go's error wrapping scheme
MIT License
248 stars 19 forks source link

panic interface conversion: ast.Expr is *ast.SelectorExpr, not *ast.Ident #42

Closed hawkingrei closed 1 year ago

hawkingrei commented 1 year ago
compilepkg: panic: interface conversion: ast.Expr is *ast.SelectorExpr, not *ast.Ident

goroutine 264 [running]:
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0xc0004c0000, 0xc000ae0e00)
    external/com_github_polyfloyd_go_errorlint/errorlint/allowed.go:160 +0x5cb
github.com/polyfloyd/go-errorlint/errorlint.isAllowedErrorComparison(0xc0004c0000, 0xc00157d920?)
    external/com_github_polyfloyd_go_errorlint/errorlint/allowed.go:91 +0x185
github.com/polyfloyd/go-errorlint/errorlint.LintErrorComparisons(0xc000e22d70?, 0xc0004c0000)
    external/com_github_polyfloyd_go_errorlint/errorlint/lint.go:182 +0x1eb
github.com/polyfloyd/go-errorlint/errorlint.run(0xc00209a410)
    external/com_github_polyfloyd_go_errorlint/errorlint/analysis.go:40 +0x6d
github.com/pingcap/tidb/build/linter/util.SkipAnalyzer.func1(0xc00209a340)
    build/linter/util/util.go:139 +0x11f
main.(*action).execOnce(0xc000527cb0)
    external/io_bazel_rules_go/go/tools/builders/nogo_main.go:303 +0x8df
sync.(*Once).doSlow(0x0?, 0x0?)
    GOROOT/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
    GOROOT/src/sync/once.go:65
main.(*action).exec(0x0?)
    external/io_bazel_rules_go/go/tools/builders/nogo_main.go:247 +0x3d
main.execAll.func1(0x0?)
    external/io_bazel_rules_go/go/tools/builders/nogo_main.go:241 +0x54
created by main.execAll
    external/io_bazel_rules_go/go/tools/builders/nogo_main.go:239 +0x47
INFO: Elapsed time: 4.440s, Critical Path: 3.66s
polyfloyd commented 1 year ago

Thanks for reporting this! Could you post a snippet of code that triggers this issue?

hawkingrei commented 1 year ago

In fact, I am adding errorlint into the tidb by nogo. Here is an PR