Skip to content

Invalid line number panic #5278

@remyleone

Description

@remyleone

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

Description of the problem

I would expect golangci-lint to not crash. Maybe sending errors but not panic

Version of golangci-lint

$ golangci-lint --version         
golangci-lint has version 1.63.1 built with go1.23.4 from 2980928 on 2025-01-01T18:03:10Z

Configuration

# paste configuration file or CLI flags here

Go environment

$ go version && go env
go version go1.23.4 darwin/arm64
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/rleone/Library/Caches/go-build'
GOENV='/Users/rleone/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/rleone/go/pkg/mod'
GONOPROXY='gitlab.infra.online.net'
GONOSUMDB='gitlab.infra.online.net'
GOOS='darwin'
GOPATH='/Users/rleone/go'
GOPRIVATE='gitlab.infra.online.net'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.23.4/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.23.4/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.4'
GODEBUG=''
GOTELEMETRY='on'
GOTELEMETRYDIR='/Users/rleone/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'

Verbose output of running

$ golangci-lint run -v ./...
INFO golangci-lint has version 1.63.1 built with go1.23.4 from 2980928 on 2025-01-01T18:03:10Z 
INFO [config_reader] Config search paths: [./ /Users/rleone/workspace/scaleway-cli /Users/rleone/workspace /Users/rleone /Users /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 65 linters: [asasalint asciicheck bidichk bodyclose canonicalheader copyloopvar decorder dogsled durationcheck errcheck errchkjson errname gci gocheckcompilerdirectives gochecksumtype goconst gocritic gocyclo gofmt gofumpt goheader goimports gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper importas ineffassign intrange loggercheck makezero mirror misspell musttag nakedret nilerr nolintlint nosprintfhostport perfsprint prealloc predeclared promlinter protogetter reassign revive rowserrcheck sloglint staticcheck stylecheck tagalign tenv testifylint testpackage thelper tparallel unconvert unparam unused usestdlibvars wastedassign whitespace zerologlint] 
INFO [loader] Go packages loading at mode 8767 (files|imports|compiled_files|exports_file|types_sizes|deps|name) took 1.514919542s 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 25.430875ms 
INFO [linters_context] importas settings found, but no aliases listed. List aliases under alias: key. 
INFO [linters_context/goanalysis] analyzers took 13m32.210503866s with top 10 stages: goimports: 51.191925416s, the_only_name: 41.775244708s, buildir: 26.400249288s, wastedassign: 19.520291168s, unconvert: 14.01887117s, musttag: 12.477721745s, unparam: 10.400576958s, gosec: 9.99347108s, gofmt: 9.615261545s, gocritic: 8.987533914s 
ERRO [runner] Panic: gofumpt: package "account" (isInitialPkg: true, needAnalyzeSource: true): invalid line number 225 (should be < 223): goroutine 35617 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:26 +0x64
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyzeSafe.func1()
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_action.go:50 +0x21c
panic({0x101781b20?, 0x1400975c550?})
        runtime/panic.go:785 +0x124
go/token.(*File).LineStart(0x1401cc6bac0?, 0x140176dd5d0?)
        go/token/position.go:232 +0x178
github.com/golangci/golangci-lint/pkg/goanalysis.EndOfLinePos(0x1401cc6baa0, 0xe0)
        github.com/golangci/golangci-lint/pkg/goanalysis/position.go:44 +0x58
github.com/golangci/golangci-lint/pkg/golinters/internal.toDiagnostic(0x1401cc6baa0, {0xdc, 0xe0, {0x1400ee06880, 0x4, 0x4}}, 0x0)
        github.com/golangci/golangci-lint/pkg/golinters/internal/diff.go:256 +0x74
github.com/golangci/golangci-lint/pkg/golinters/internal.ExtractDiagnosticFromPatch(0x1400376c620, 0x14014d06c80, {0x1401097ec00, 0x396}, 0x140000b1740)
        github.com/golangci/golangci-lint/pkg/golinters/internal/diff.go:245 +0x334
github.com/golangci/golangci-lint/pkg/golinters/gofumpt.runGofumpt(0x140000b1740, 0x1400376c620, {0x1019d3500, 0x1025998c8}, {{0x14000f13220, 0x8}, {0x0, 0x0}, 0x0})
        github.com/golangci/golangci-lint/pkg/golinters/gofumpt/gofumpt.go:89 +0x324
github.com/golangci/golangci-lint/pkg/golinters/gofumpt.New.func1.1(0x10000000000?)
        github.com/golangci/golangci-lint/pkg/golinters/gofumpt/gofumpt.go:52 +0x48
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyze.func3(0x14004dd4a00, 0x1400376c620)
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_checker.go:182 +0xd0
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyze(0x14004dd4a00)
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_checker.go:208 +0x97c
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0x14002a2be50, {0x1013caef5, 0x7}, 0x14002daff30)
        github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x44
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyzeSafe(0x100d28cf0?)
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_action.go:54 +0x70
github.com/golangci/golangci-lint/pkg/goanalysis.(*loadingPackage).analyze.func2(0x14004dd4a00)
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_loadingpackage.go:83 +0xac
created by github.com/golangci/golangci-lint/pkg/goanalysis.(*loadingPackage).analyze in goroutine 1097
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_loadingpackage.go:78 +0x174 
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: gofumpt: package "account" (isInitialPkg: true, needAnalyzeSource: true): invalid line number 225 (should be < 223) 
INFO [runner] processing took 1.705µs with stages: max_same_issues: 458ns, skip_dirs: 208ns, filename_unadjuster: 167ns, cgo: 167ns, path_prettifier: 125ns, max_per_file_from_linter: 83ns, path_shortener: 42ns, severity-rules: 42ns, autogenerated_exclude: 42ns, nolint: 42ns, invalid_issue: 42ns, path_prefixer: 41ns, sort_results: 41ns, max_from_linter: 41ns, fixer: 41ns, skip_files: 41ns, uniq_by_line: 41ns, diff: 41ns, exclude: 0s, exclude-rules: 0s, identifier_marker: 0s, source_code: 0s 
INFO [runner] linters took 13.926692958s with stages: goanalysis_metalinter: 13.92600125s 
ERRO Running error: can't run linter goanalysis_metalinter
goanalysis_metalinter: gofumpt: package "account" (isInitialPkg: true, needAnalyzeSource: true): invalid line number 225 (should be < 223) 
INFO Memory: 156 samples, avg is 563.9MB, max is 1011.6MB 
INFO Execution took 15.4908795s                   
(

A minimal reproducible example or link to a public repository

https://github.com/scaleway/scaleway-cli
You should reproduce with this commit scaleway/scaleway-cli@d03f829

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions