Skip to content

unparam in 1.64.8 crashes #5581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 of 7 tasks
FGasper opened this issue Mar 19, 2025 · 2 comments
Closed
6 of 7 tasks

unparam in 1.64.8 crashes #5581

FGasper opened this issue Mar 19, 2025 · 2 comments
Labels
bug Something isn't working dependencies Relates to an upstream dependency

Comments

@FGasper
Copy link

FGasper commented Mar 19, 2025

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

How did you install golangci-lint?

Official binary

Description of the problem

In my team’s (closed-source) code base, unparam from golangci-lint fails with runtime error: invalid memory address or nil pointer dereference.

It appears that 1.64 just needs to update its unparam to include this patch.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.64.8 built with go1.24.1 from 8b37f141 on 2025-03-17T20:41:53Z

Configuration

# paste configuration file or CLI flags here

Go environment

(I don’t think this is relevant since I identified the likely fix above. Please advise otherwise.)

Verbose output of running

INFO golangci-lint has version 1.64.8 built with go1.24.1 from 8b37f141 on 2025-03-17T20:41:53Z
INFO [config_reader] Config search paths: [./ /Users/felipe/go/src/github.com/10gen/mongosync/internal/mongosync/integration /Users/felipe/go/src/github.com/10gen/mongosync/internal/mongosync /Users/felipe/go/src/github.com/10gen/mongosync/internal /Users/felipe/go/src/github.com/10gen/mongosync /Users/felipe/go/src/github.com/10gen /Users/felipe/go/src/github.com /Users/felipe/go/src /Users/felipe/go /Users/felipe /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [goenv] Read go env for 10.326708ms: map[string]string{"GOCACHE":"/Users/felipe/Library/Caches/go-build", "GOROOT":"/Users/felipe/.local/share/mise/installs/go/1.24.1"}
INFO [lintersdb] Active 1 linters: [unparam]
INFO [loader] Using build tags: [mstests ruleguard]
INFO [loader] Go packages loading at mode 8767 (compiled_files|deps|files|imports|name|exports_file|types_sizes) took 1.027065875s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 50.087875ms
INFO [linters_context/goanalysis] analyzers took 120.354875ms with top 10 stages: buildssa: 120.34275ms, typecheck: 12.125µs
ERRO [runner] Panic: unparam: package "integration" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 5384 [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 +0x218
panic({0x103737c40?, 0x1042ad330?})
	runtime/panic.go:792 +0x124
go/types.(*Named).Obj(...)
	go/types/named.go:308
mvdan.cc/unparam/check.(*Checker).multipleImpls(0x14000a27220, 0x14001dfb6c0, 0x1400bf50600)
	mvdan.cc/[email protected]/check/check.go:943 +0xe8
mvdan.cc/unparam/check.(*Checker).checkFunc(0x14000a27220, 0x1400bf50600, 0x14001dfb6c0)
	mvdan.cc/[email protected]/check/check.go:493 +0x1cc
mvdan.cc/unparam/check.(*Checker).Check(0x14000a27220)
	mvdan.cc/[email protected]/check/check.go:377 +0x5e4
github.com/golangci/golangci-lint/pkg/golinters/unparam.runUnparam(0x1400100f340, 0x140002706d8)
	github.com/golangci/golangci-lint/pkg/golinters/unparam/unparam.go:59 +0x1a0
github.com/golangci/golangci-lint/pkg/golinters/unparam.New.func1(0x103766660?)
	github.com/golangci/golangci-lint/pkg/golinters/unparam/unparam.go:22 +0x20
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyze.func3(...)
	github.com/golangci/golangci-lint/pkg/goanalysis/runner_checker.go:182
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyze(0x140010440a0)
	github.com/golangci/golangci-lint/pkg/goanalysis/runner_checker.go:208 +0xa0c
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0x140024ca8c0, {0x10332f5b8, 0x7}, 0x140031c6f30)
	github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x44
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyzeSafe(0x102ca41c0?)
	github.com/golangci/golangci-lint/pkg/goanalysis/runner_action.go:54 +0x70
github.com/golangci/golangci-lint/pkg/goanalysis.(*loadingPackage).analyze.func2(0x140010440a0)
	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 112
	github.com/golangci/golangci-lint/pkg/goanalysis/runner_loadingpackage.go:78 +0x170
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: unparam: package "integration" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Text: "(?i)composites: .+(primitive\\.(Binary|E|Timestamp)|bson\\.E|mmaps\\.Pair\\[.+\\]|types.(Destination|Source)(Client|Database)) struct literal uses unkeyed fields", Path: ".+\\.go"]
INFO [runner] processing took 10.165µs with stages: exclusion_rules: 8.5µs, max_same_issues: 417ns, skip_dirs: 291ns, exclusion_paths: 209ns, path_absoluter: 208ns, nolint_filter: 83ns, max_per_file_from_linter: 42ns, cgo: 42ns, filename_unadjuster: 42ns, invalid_issue: 42ns, path_relativity: 42ns, fixer: 42ns, max_from_linter: 41ns, uniq_by_line: 41ns, source_code: 41ns, diff: 41ns, path_shortener: 41ns, skip_files: 0s, severity-rules: 0s, sort_results: 0s, generated_file_filter: 0s, identifier_marker: 0s, path_prettifier: 0s
INFO [runner] linters took 668.624834ms with stages: goanalysis_metalinter: 668.282875ms
ERRO Running error: can't run linter goanalysis_metalinter
goanalysis_metalinter: unparam: package "integration" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference
INFO Memory: 19 samples, avg is 93.6MB, max is 284.4MB
INFO Execution took 1.7567975s

A minimal reproducible example or link to a public repository

The unparam patch’s foo.go also demonstrates the problem.

Validation

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

Supporter

@FGasper FGasper added the bug Something isn't working label Mar 19, 2025
Copy link

boring-cyborg bot commented Mar 19, 2025

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez added the dependencies Relates to an upstream dependency label Mar 19, 2025
@FGasper FGasper changed the title unparam in 1.64 crashes unparam in 1.64.8 crashes Mar 19, 2025
@ldez
Copy link
Member

ldez commented Mar 19, 2025

Fixed by #5584

@ldez ldez closed this as completed Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Relates to an upstream dependency
Projects
None yet
Development

No branches or pull requests

2 participants