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: runtime error: index out of range [1] with length 1 #29

Closed Dentrax closed 2 years ago

Dentrax commented 2 years ago
$ golangci-lint --version
golangci-lint has version 1.49.0 built from cc2d97f on 2022-08-23T12:03:20Z
$ golangci-lint run ./... -v

INFO [config_reader] Config search paths: [./ /Users/furkan.turkal/go/src/foo /Users/furkan.turkal/go/src /Users/furkan.turkal/go /Users/furkan.turkal /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 30 linters: [asciicheck bodyclose depguard errcheck errorlint exportloopref gocritic gofmt gofumpt goimports gosec gosimple govet importas ineffassign misspell nilerr prealloc predeclared revive rowserrcheck sqlclosecheck staticcheck stylecheck tparallel typecheck unconvert unparam unused whitespace]
INFO [loader] Go packages loading at mode 575 (deps|files|imports|compiled_files|name|types_sizes|exports_file) took 1.58467684s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 12.800528ms
INFO [linters context] importas settings found, but no aliases listed. List aliases under alias: key.
INFO [linters context/goanalysis] analyzers took 4.043855267s with top 10 stages: buildir: 1.370088859s, buildssa: 1.193582957s, unparam: 195.154349ms, the_only_name: 178.160126ms, gocritic: 125.858205ms, fact_deprecated: 105.166517ms, ctrlflow: 96.88613ms, goimports: 88.741122ms, printf: 84.125222ms, gofumpt: 63.678242ms
ERRO [runner] Panic: errorlint: package "remote" (isInitialPkg: true, needAnalyzeSource: true): runtime error: index out of range [1] with length 1: goroutine 9560 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x155
panic({0x4d9d2e0, 0xc003f234a0})
        runtime/panic.go:884 +0x212
github.com/polyfloyd/go-errorlint/errorlint.verbOrder(...)
        github.com/polyfloyd/go-errorlint@v1.0.2/errorlint/printf.go:17
github.com/polyfloyd/go-errorlint/errorlint.printfFormatStringVerbs({0xc0022e7950, 0xc0022e7980, 0xc0022e79b0, 0xc0022e79e0, 0xc0022e7a10, 0xc0022e7a70, 0xc0022e7a40, {0x0, 0x0, 0x0}}, ...)
        github.com/polyfloyd/go-errorlint@v1.0.2/errorlint/lint.go:106 +0x3c5
github.com/polyfloyd/go-errorlint/errorlint.LintFmtErrorfCalls(0xc003ba4c50?, {0xc0022e7950, 0xc0022e7980, 0xc0022e79b0, 0xc0022e79e0, 0xc0022e7a10, 0xc0022e7a70, 0xc0022e7a40, {0x0, 0x0, ...}})
        github.com/polyfloyd/go-errorlint@v1.0.2/errorlint/lint.go:39 +0x1d8
github.com/polyfloyd/go-errorlint/errorlint.run(0xc00447e000)
        github.com/polyfloyd/go-errorlint@v1.0.2/errorlint/analysis.go:46 +0x2b8
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0032dab50)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:187 +0x9d6
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc000e17180, {0x4e25811, 0x9}, 0xc002be2f48)
        github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc001653ec0?)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:104 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0032dab50)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: errorlint: package "remote" (isInitialPkg: true, needAnalyzeSource: true): runtime error: index out of range [1] with length 1
WARN [linters context] rowserrcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
WARN [linters context] sqlclosecheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
INFO [runner] processing took 14.288µs with stages: max_same_issues: 10.306µs, filename_unadjuster: 587ns, skip_files: 405ns, skip_dirs: 387ns, max_from_linter: 303ns, nolint: 281ns, cgo: 236ns, autogenerated_exclude: 178ns, diff: 173ns, path_prettifier: 170ns, exclude-rules: 162ns, exclude: 156ns, source_code: 151ns, identifier_marker: 151ns, uniq_by_line: 145ns, max_per_file_from_linter: 144ns, sort_results: 101ns, path_shortener: 95ns, path_prefixer: 86ns, severity-rules: 71ns
INFO [runner] linters took 6.70066414s with stages: goanalysis_metalinter: 6.700512213s, rowserrcheck: 12.956µs, sqlclosecheck: 12.277µs
ERRO Running error: 1 error occurred:
        * can't run linter goanalysis_metalinter: goanalysis_metalinter: errorlint: package "remote" (isInitialPkg: true, needAnalyzeSource: true): runtime error: index out of range [1] with length 1

INFO Memory: 85 samples, avg is 101.2MB, max is 332.4MB
INFO Execution took 8.343244986s
polyfloyd commented 2 years ago

Hi @Dentrax, thank you for reporting this! You did not attach problematic source code, so I reproduced this myself. Could you check whether this resolves your issue?

Dentrax commented 2 years ago

Hey @polyfloyd, thanks for prompt action! 🚀

I couldn't attach a source code due to source code license issues. Sorry for the inconvenience. It seems my issue is fixed! 👍 You can bump the version to submit an update for golangci-lint.

polyfloyd commented 2 years ago

Cool, thx!