dominikh / go-tools

Staticcheck - The advanced Go linter
https://staticcheck.dev
MIT License
6.22k stars 377 forks source link

go 1.23: "cannot range over seq" errors in the "iter.go" #1591

Closed PhilippSieber closed 3 months ago

PhilippSieber commented 3 months ago

Staring from version 0.5.0 (0.5.1 also affected), getting cannot range over seq errors in the iter.go source file, when running staticcheck with go 1.23 installed (macOS).

Sample repo to reproduce: https://github.com/getyourguide/dependabutler

% git clone git@github.com:getyourguide/dependabutler
% cd dependabutler
% staticcheck ./...
-: /usr/local/go/src/maps/iter.go:51:20: cannot range over seq (variable of type iter.Seq2[K, V]) (compile)
-: /usr/local/go/src/slices/iter.go:50:17: cannot range over seq (variable of type iter.Seq[E]) (compile)

% staticcheck -version
staticcheck 2024.1 (0.5.0)

% staticcheck -debug.version
staticcheck 2024.1 (0.5.0)

Compiled with Go version: go1.22.6
Main module:
    honnef.co/go/tools
Dependencies:
    github.com/BurntSushi/toml@v1.4.1-0.20240526193622-a339e1f7089c (sum: h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=)
    golang.org/x/exp/typeparams@v0.0.0-20231108232855-2478ac86f678 (sum: h1:1P7xPZEwZMoBoz0Yze5Nx2/4pxj6nw9ZqHWXqP0iRgQ=)
    golang.org/x/mod@v0.17.0 (sum: h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=)
    golang.org/x/sync@v0.7.0 (sum: h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=)
    golang.org/x/tools@v0.21.1-0.20240531212143-b6235391adb3 (sum: h1:SHq4Rl+B7WvyM4XODon1LXtP7gcG49+7Jubt1gWWswY=)

%go version
go version go1.23.0 darwin/amd64

% go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/philipp.sieber/Library/Caches/go-build'
GOENV='/Users/philipp.sieber/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/philipp.sieber/go/pkg/mod'
GONOPROXY='github.com/getyourguide/dependabottler'
GONOSUMDB='github.com/getyourguide/dependabottler'
GOOS='darwin'
GOPATH='/Users/philipp.sieber/go'
GOPRIVATE='github.com/getyourguide/dependabottler'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/philipp.sieber/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/philipp.sieber/gyg/dns-log-transfer/go.mod'
GOWORK=''
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/07/z9qr16991d92pkvx8lr04p4w0000gn/T/go-build1054133824=/tmp/go-build -gno-record-gcc-switches -fno-common'
dominikh commented 3 months ago

Compiled with Go version: go1.22.6

To use Staticcheck with Go 1.23, you'll have to build it with Go 1.23, too.