go run github.com/golangci/golangci-lint/cmd/golangci-lint version
# github.com/golangci/golangci-lint/pkg/golinters
../../../../go/bin/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/whitespace.go:68:63: too many arguments in call to whitespace.Run
have (*"go/ast".File, *"go/token".FileSet, whitespace.Settings)
want (*analysis.Pass, *whitespace.Settings)
../../../../go/bin/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/whitespace.go:79:17: i.Pos undefined (type whitespace.Message has no field or method Pos)
../../../../go/bin/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/whitespace.go:80:17: i.Pos undefined (type whitespace.Message has no field or method Pos)
../../../../go/bin/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/whitespace.go:82:39: i.Pos undefined (type whitespace.Message has no field or method Pos)
../../../../go/bin/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/whitespace.go:93:12: i.Type undefined (type whitespace.Message has no field or method Type)
../../../../go/bin/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/whitespace.go:94:19: undefined: whitespace.MessageTypeLeading
../../../../go/bin/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/whitespace.go:96:19: undefined: whitespace.MessageTypeTrailing
../../../../go/bin/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/whitespace.go:99:19: undefined: whitespace.MessageTypeAddAfter
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest version
golangci-lint has version v1.55.2 built with go1.21.4 from (unknown, mod sum: "h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8=") on (unknown)
This is preventing me from running the linter in a repo with a tools package like:
internal/tools/tools.go
//go:build tools
// +build tools
package tools
import (
// ...
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
// ...
)
I have tried removing it from $GOPATH and I have also tried go clean -modcache to no avail. I am really at a loss here, you can see the versions are the same regardless of the way I execute it so I don't know how I could run into this error. When I google it, there are literally 0 results so I imagine this is something to do with how Go is set up on my system but I'm out of ideas on what to look for, so in case it helps, the following is in my .zshrc file:
export GO_121_PATH="/Users/user/sdk/$GO_121/bin"
## Set go env vars
export GOPATH="$HOME/go/bin"
export GOBIN="$GOPATH"
export PATH="$GOBIN:$PATH"
export GOMAXPROCS=6
## Set current version of go command
export PATH="$GO_121_PATH:$PATH"