Skip to content

panic: close of closed channel #5938

@alex-aizman

Description

@alex-aizman

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?

I don't know

Description of the problem

This is https://github.com/NVIDIA/aistore

The following single-line diff in our CLI module generates reproducible panic:

$ git diff
diff --git a/cmd/cli/cli/lhotse.go b/cmd/cli/cli/lhotse.go
index 1a13987aa..b00a2aa14 100644
--- a/cmd/cli/cli/lhotse.go
+++ b/cmd/cli/cli/lhotse.go
@@ -284,7 +284,7 @@ func lhotseMultiBatch(c *cli.Context, outCtx *mossReqParseCtx) error {
 
        // remaining cuts in a final batch
        if len(currentBatch) > 0 {
-               shardName, hasNext := outCtx.pt.Next()
+               shardName, hasNext := outCtx.pt.Apply()
                if !hasNext {
                        return fmt.Errorf("template exhausted for final batch (generated %d batches so far)", totalBatches)
                }

and

$ make lint
Running lint...
0 issues.
Running lint cmd/cli...
panic: close of closed channel
  
goroutine 726 [running]:
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*loadingPackage).analyze(0xc003f5fec0, 0xc0029390a0, 0x2, 0xc002939030)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go:110 +0x31c
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*loadingPackage).analyzeRecursive.func1()
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go:61 +0x1c5
sync.(*Once).doSlow(0x40?, 0x100000000000000?)
        sync/once.go:78 +0xab
sync.(*Once).Do(...)
        sync/once.go:69
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*loadingPackage).analyzeRecursive(0xd4e000?, 0xc003511780?, 0xc0000ebf90?, 0xc0000ebfd0?)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go:45 +0x45
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*runner).analyze.func2(0x37?)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner.go:273 +0x2c
created by github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*runner).analyze in goroutine 1
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner.go:272 +0x5fa
make[1]: *** [Makefile:14: lint] Error 2
make: *** [Makefile:273: lint] Error 2

We have the latest:

$ golangci-lint version
golangci-lint has version 2.2.2 built with go1.24.4 from e9d42511 on 2025-07-11T12:00:50Z

Version of golangci-lint

golangci-lint has version 2.2.2 built with go1.24.4 from e9d42511 on 2025-07-11T12:00:50Z

Configuration

https://github.com/NVIDIA/aistore/blob/main/.golangci.yml

Go environment

 golangci-lint version
golangci-lint has version 2.2.2 built with go1.24.4 from e9d42511 on 2025-07-11T12:00:50Z
$ go version
go version go1.24.3 linux/amd64
$ go env
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3712995069=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/root/gocode/src/github.com/NVIDIA/aistore/go.mod'
GOMODCACHE='/root/gocode/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/gocode'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.3'
GOWORK=''
PKG_CONFIG='pkg-config'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v

$ golangci-lint cache clean
$ cd cmd/cli/
$ golangci-lint run -v
INFO golangci-lint has version 2.2.2 built with go1.24.4 from e9d42511 on 2025-07-11T12:00:50Z 
INFO [config_reader] Config search paths: [./ /root/gocode/src/github.com/NVIDIA/aistore/cmd/cli /root/gocode/src/github.com/NVIDIA/aistore/cmd /root/gocode/src/github.com/NVIDIA/aistore /root/gocode/src/github.com/NVIDIA /root/gocode/src/github.com /root/gocode/src /root/gocode /root /] 
INFO [config_reader] Used config file ../../.golangci.yml 
INFO [goenv] Read go env for 2.832204ms: map[string]string{"GOCACHE":"/root/.cache/go-build", "GOROOT":"/usr/local/go"} 
INFO [lintersdb] Active 40 linters: [asciicheck bodyclose canonicalheader copyloopvar depguard dogsled dupl dupword durationcheck fatcontext gochecksumtype gocritic gofmt goheader goimports gomoddirectives goprintffuncname govet importas ineffassign intrange misspell musttag nakedret nilnesserr noctx nolintlint perfsprint prealloc protogetter reassign revive staticcheck testpackage unconvert unparam unused usetesting wastedassign whitespace] 
INFO [loader] Using build tags: [hrw aws azure gcp oci] 
INFO [loader] Go packages loading at mode 8767 (compiled_files|exports_file|files|imports|types_sizes|deps|name) took 237.67416ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 17.488176ms 
INFO [linters_context] importas settings found, but no aliases listed. List aliases under alias: key. 
panic: close of closed channel

goroutine 505 [running]:
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*loadingPackage).analyze(0xc003084360, 0xc003982070, 0x2, 0xc003982000)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go:110 +0x31c
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*loadingPackage).analyzeRecursive.func1()
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go:61 +0x1c5
sync.(*Once).doSlow(0x40?, 0x100000000000000?)
        sync/once.go:78 +0xab
sync.(*Once).Do(...)
        sync/once.go:69
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*loadingPackage).analyzeRecursive(0xd4e000?, 0xc00266ebb0?, 0xc0003cb790?, 0xc0003cb7d0?)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go:45 +0x45
github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*runner).analyze.func2(0x25?)
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner.go:273 +0x2c
created by github.com/golangci/golangci-lint/v2/pkg/goanalysis.(*runner).analyze in goroutine 1
        github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner.go:272 +0x5fa

A minimal reproducible example or link to a public repository

NVIDIA/aistore - see above

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