Skip to content

intrange causing panic #4629

Closed
Closed
@koblas

Description

@koblas

Welcome

Description of the problem

https://github.com/ckaznocha/intrange should be updated to the 0.1.2 version

Currently experiencing a crash that mirrors the 0.1.1 -> 0.1.2 fix.

ckaznocha/intrange#16

Version of golangci-lint

$ golangci-lint --version
# Paste output here

Configuration

golangci-lint has version 1.57.2 built with go1.22.1 from 77a8601 on 2024-03-28T18:39:06Z

Go environment

go version go1.22.2 darwin/arm64
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/koblas/Library/Caches/go-build'
GOENV='/Users/koblas/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/koblas/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/koblas/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.2/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.2/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/koblas/repos/github.com/koblas/content_buddy/go/go.mod'
GOWORK='/Users/koblas/repos/github.com/koblas/content_buddy/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/jv/51g_1pw53kn_29p1s2z22h8c0000gn/T/go-build620875179=/tmp/go-build -gno-record-gcc-switches -fno-common'```

</details>

### Verbose output of running

<details>

```console

INFO [config_reader] Config search paths: [./ /Users/koblas/repos/github.com/koblas/content_buddy/go /Users/koblas/repos/github.com/koblas/content_buddy /Users/koblas/repos/github.com/koblas /Users/koblas/repos/github.com /Users/koblas/repos /Users/koblas /Users /] 
INFO [config_reader] Used config file .golangci.yaml 
INFO [lintersdb] Active 83 linters: [asasalint asciicheck bidichk bodyclose containedctx contextcheck copyloopvar decorder dogsled dupword durationcheck errcheck errchkjson errname errorlint execinquery exhaustive exportloopref forbidigo gci ginkgolinter gocheckcompilerdirectives gochecksumtype gocritic godot goerr113 gofmt gofumpt goheader goimports gomoddirectives gomodguard goprintffuncname gosec gosimple gosmopolitan govet grouper importas inamedparam ineffassign interfacebloat intrange lll loggercheck maintidx makezero mirror misspell musttag nakedret nilerr nilnil noctx nolintlint nonamedreturns nosprintfhostport perfsprint prealloc predeclared promlinter reassign revive rowserrcheck sloglint spancheck sqlclosecheck staticcheck stylecheck tagalign tenv testableexamples testifylint thelper tparallel unconvert unparam unused usestdlibvars wastedassign whitespace wrapcheck zerologlint] 
INFO [loader] Go packages loading at mode 575 (imports|types_sizes|compiled_files|deps|exports_file|files|name) took 465.947208ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 15.14925ms 
INFO [linters_context] importas settings found, but no aliases listed. List aliases under alias: key. 
INFO [linters_context/goanalysis] analyzers took 6m42.822309227s with top 10 stages: buildir: 51.664308337s, buildssa: 16.762798544s, wastedassign: 16.085580743s, the_only_name: 13.272174117s, bidichk: 7.433157408s, musttag: 6.062694963s, exhaustive: 5.546524407s, unconvert: 4.762067668s, unparam: 4.41060488s, printf: 4.266245959s 
ERRO [runner] Panic: intrange: package "confmgr" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: ast.Expr is *ast.SelectorExpr, not *ast.Ident: goroutine 32161 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x64
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyzeSafe.func1()
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_action.go:108 +0x214
panic({0x103add240?, 0x1406cde1ad0?})
        runtime/panic.go:770 +0x124
github.com/ckaznocha/intrange.findNExpr({0x103c59608?, 0x1403ca5a8c0?})
        github.com/ckaznocha/intrange@v0.1.1/intrange.go:237 +0x1a0
github.com/ckaznocha/intrange.run.check.func1({0x103c55450?, 0x1403ca5b000})
        github.com/ckaznocha/intrange@v0.1.1/intrange.go:95 +0x1c4
golang.org/x/tools/go/ast/inspector.(*Inspector).Preorder(0x1406914da70, {0x140463d7c78?, 0x1044bfd40?, 0x14002ec59e0?}, 0x14045243c68)
        golang.org/x/tools@v0.19.0/go/ast/inspector/inspector.go:82 +0x90
github.com/ckaznocha/intrange.run(0x1406d93b450)
        github.com/ckaznocha/intrange@v0.1.1/intrange.go:47 +0x124
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyze(0x14004f3b500)
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_action.go:190 +0x8c4
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyzeSafe.func2()
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_action.go:112 +0x20
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0x140023760a0, {0x1036c98d5, 0x8}, 0x14005843730)
        github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x44
github.com/golangci/golangci-lint/pkg/goanalysis.(*action).analyzeSafe(0x0?)
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_action.go:111 +0x78
github.com/golangci/golangci-lint/pkg/goanalysis.(*loadingPackage).analyze.func2(0x14004f3b500)
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_loadingpackage.go:80 +0xb0
created by github.com/golangci/golangci-lint/pkg/goanalysis.(*loadingPackage).analyze in goroutine 785
        github.com/golangci/golangci-lint/pkg/goanalysis/runner_loadingpackage.go:75 +0x184 
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: intrange: package "confmgr" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: ast.Expr is *ast.SelectorExpr, not *ast.Ident 
INFO [runner] processing took 1.329µs with stages: max_same_issues: 459ns, skip_dirs: 166ns, cgo: 125ns, max_from_linter: 125ns, nolint: 42ns, fixer: 42ns, sort_results: 42ns, path_prettifier: 41ns, skip_files: 41ns, uniq_by_line: 41ns, source_code: 41ns, exclude: 41ns, exclude-rules: 41ns, identifier_marker: 41ns, diff: 41ns, severity-rules: 0s, filename_unadjuster: 0s, path_shortener: 0s, autogenerated_exclude: 0s, max_per_file_from_linter: 0s, invalid_issue: 0s, path_prefixer: 0s 
INFO [runner] linters took 10.552233792s with stages: goanalysis_metalinter: 10.552200333s 
ERRO Running error: can't run linter goanalysis_metalinter
goanalysis_metalinter: intrange: package "confmgr" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: ast.Expr is *ast.SelectorExpr, not *ast.Ident 
INFO Memory: 110 samples, avg is 1322.8MB, max is 2669.4MB 
INFO Execution took 11.040166833s                 

A minimal reproducible example or link to a public repository

// Unable to provide specific line

Validation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesRelates to an upstream dependency

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions