You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ golangci-lint --versiongolangci-lint has version 1.46.2 built from a3336890 on 2022-05-17T11:31:29Z
Note: building golangci-lint master branch fails as well
Configuration file
$ cat .golangci.ymlcat: .golangci.yml: No such file or directory
Go environment
$ go version && go envgo version go1.18.3 linux/amd64GO111MODULE=""GOARCH="amd64"GOBIN=""GOCACHE="/home/urso/.cache/go-build"GOENV="/home/urso/.config/go/env"GOEXE=""GOEXPERIMENT=""GOFLAGS=""GOHOSTARCH="amd64"GOHOSTOS="linux"GOINSECURE=""GOMODCACHE="/home/urso/go/pkg/mod"GONOPROXY=""GONOSUMDB=""GOOS="linux"GOPATH="/home/urso/go"GOPRIVATE=""GOPROXY="https://proxy.golang.org,direct"GOROOT="/home/urso/.asdf/installs/golang/1.18.3/go"GOSUMDB="sum.golang.org"GOTMPDIR=""GOTOOLDIR="/home/urso/.asdf/installs/golang/1.18.3/go/pkg/tool/linux_amd64"GOVCS=""GOVERSION="go1.18.3"GCCGO="gccgo"GOAMD64="v1"AR="ar"CC="gcc"CXX="g++"CGO_ENABLED="1"GOMOD="/home/urso/workspace/src/github.com/urso/checkerr/go.mod"GOWORK=""CGO_CFLAGS="-g -O2"CGO_CPPFLAGS=""CGO_CXXFLAGS="-g -O2"CGO_FFLAGS="-g -O2"CGO_LDFLAGS="-g -O2"PKG_CONFIG="pkg-config"GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build254684928=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -vINFO [config_reader] Config search paths: [./ /home/urso/workspace/src/github.com/urso/checkerr /home/urso/workspace/src/github.com/urso /home/urso/workspace/src/github.com /home/urso/workspace/src /home/urso/workspace /home/urso /home /]INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]INFO [loader] Go packages loading at mode 575 (files|imports|name|compiled_files|exports_file|types_sizes|deps) took 206.946885msINFO [runner/filename_unadjuster] Pre-built 0 adjustments in 120.849µsINFO [linters context/goanalysis] analyzers took 1.308125511s with top 10 stages: buildir: 851.821139ms, fact_purity: 85.363223ms, ctrlflow: 73.018183ms, nilness: 65.477231ms, printf: 63.824508ms, inspect: 62.209949ms, fact_deprecated: 42.903237ms, SA5012: 28.541561ms, typedness: 23.689558ms, S1020: 414.867µsERRO [runner] Panic: S1029: package "main" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildir.IR: goroutine 1377 [running]:runtime/debug.Stack() runtime/debug/stack.go:24 +0x65github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1() github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x155panic({0xf00a80, 0xc008ea8ff0}) runtime/panic.go:838 +0x207honnef.co/go/tools/internal/sharedcheck.CheckRangeStringRunes(0xc00115a5b0) honnef.co/go/tools@v0.3.1/internal/sharedcheck/lint.go:24 +0x17bhonnef.co/go/tools/simple.CheckRangeStringRunes(0xee2aa0?) honnef.co/go/tools@v0.3.1/simple/lint.go:1630 +0x19github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0015b4010) github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:187 +0x9c4github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2() github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x1dgithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0004956d0, {0x10130c8, 0x5}, 0xc000cde748) github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4agithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x0?) github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:104 +0x85github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0015b4010) github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1ebWARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: S1029: package "main" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildir.IRWARN [linters context] structcheck is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649.INFO [runner] processing took 3.699µs with stages: max_same_issues: 999ns, nolint: 330ns, max_from_linter: 290ns, skip_dirs: 280ns, cgo: 260ns, skip_files: 200ns, autogenerated_exclude: 160ns, path_prettifier: 160ns, filename_unadjuster: 160ns, exclude: 150ns, source_code: 80ns, sort_results: 70ns, diff: 70ns, severity-rules: 70ns, max_per_file_from_linter: 70ns, uniq_by_line: 70ns, exclude-rules: 70ns, path_prefixer: 70ns, identifier_marker: 70ns, path_shortener: 70nsINFO [runner] linters took 1.013487199s with stages: goanalysis_metalinter: 1.01342836s, structcheck: 11.27µsERRO Running error: 1 error occurred: * can't run linter goanalysis_metalinter: goanalysis_metalinter: S1029: package "main" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildir.IRINFO Memory: 14 samples, avg is 145.6MB, max is 223.0MBINFO Execution took 1.296626962s
Code example or link to a public repository
package main
import"fmt"funcprintGeneric[Tany](vT) {
fmt.Println(v)
}
funcunused() {}
funcmain() {
printInt:=printGeneric[int] // This line seems to produce the panic in the linterprintInt(1)
}
The text was updated successfully, but these errors were encountered:
Welcome
Description of the problem
When instantiating a generic function into a local variable like
myvar := mygenericfunc[int]
golangci-lint produces a panic.The sample code given reproduces the problem. The sample code includes an unused function that shall be flagged by the linter.
It seems the staticcheck based linters like
ununsed
,gosimple
,staticcheck
are affected.Testing the sample code with staticcheck works for me:
Version of golangci-lint
Note: building golangci-lint master branch fails as well
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
The text was updated successfully, but these errors were encountered: