X/tools/cmd/deadcode "package requires newer Go version"

Trying to use deadcode in my project fails with

$ deadcode "-tags" "server_vql extras" "-json" "./vql/"
/home/mic/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.1.linux-amd64/src/slices/iter.go:50:17: cannot range over seq (variable of type iter.Seq[E])
/home/mic/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.1.linux-amd64/src/maps/iter.go:51:20: cannot range over seq (variable of type iter.Seq2[K, V])
/home/mic/projects/velociraptor/proto/flow_metadata.pb.go:4:1: package requires newer Go version go1.23
/home/mic/projects/velociraptor/acls/proto/acl.pb.go:4:1: package requires newer Go version go1.23
/home/mic/projects/velociraptor/artifacts/proto/artifact.pb.go:4:1: package requires newer Go version go1.23
/home/mic/projects/velociraptor/actions/proto/transport.pb.go:4:1: package requires newer Go version go1.23

The project go.mod specifies the toolchain as 1.23 and it builds fine but it seems that the deadcode tool insists on using an older version when trying to analyse.

Not sure if this is a bug in deadcode or somehow im using it wrong - I am sure this used to work

I figured it out - I actually had an older version installed on the system but I didn’t even realize it because Go will just automatically install and use the most recent version when building normally inside the project. However deadcode uses the system go in any case which can be surprising.

Running go version inside the project directory reports go 1.23 - even when physically pointing it at the same binary with a full path. While running the exact same binary outside the project directory reported go 1.22 - this is very confusing behavior !

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.