Skip to content

goLint: unable to lint with golangci-lint v1 #3843

@trond-snekvik

Description

@trond-snekvik

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go1.23.10 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.19.1
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.103.0
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.48.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
# Tools Configuration


## Environment

GOBIN: undefined
toolsGopath: 
gopath: /home/trond/go
GOROOT: /usr/local/go
PATH: /home/trond/.npm/bin:/home/trond/.local/bin:/home/trond/bin:/home/trond/Downloads/google-cloud-cli-linux-x86_64/google-cloud-sdk/bin:/home/trond/.local/share/pnpm:/home/trond/.nvm/versions/node/v20.12.1/bin:/home/trond/.cargo/bin:/home/trond/.npm/bin:/home/trond/.local/bin:/home/trond/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/trond/.dotnet/tools:/home/trond/.local/bin:/home/trond/.dotnet/tools:/home/trond/bin:~/.local/bin:/home/trond/.yarn/bin:/home/trond/go/bin:/usr/local/go/bin:/home/trond/.local/bin:/usr/java/jre1.8.0_441/bin:/home/trond/.local/bin

## Tools

	go:	/usr/local/go/bin/go: go version go1.23.10 linux/amd64

	gopls:	/home/trond/go/bin/gopls	(version: v0.19.1 built with go: go1.24.4)
	gotests:	not installed
	impl:	not installed
	goplay:	not installed
	dlv:	/home/trond/go/bin/dlv	(version: v1.23.1 built with go: go1.23.3)
	golangci-lint:	/home/trond/go/bin/golangci-lint	(version: (devel) built with go: go1.23.0)

## Go env

Workspace Folder (MYWORKSPACE): /home/trond/MYDIR

	GO111MODULE=''
	GOARCH='amd64'
	GOBIN=''
	GOCACHE='/home/trond/.cache/go-build'
	GOENV='/home/trond/.config/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='amd64'
	GOHOSTOS='linux'
	GOINSECURE=''
	GOMODCACHE='/home/trond/go/pkg/mod'
	GONOPROXY='github.com/ORG'
	GONOSUMDB='github.com/ORG'
	GOOS='linux'
	GOPATH='/home/trond/go'
	GOPRIVATE='github.com/ORG'
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/usr/local/go'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
	GOVCS=''
	GOVERSION='go1.23.10'
	GODEBUG=''
	GOTELEMETRY='local'
	GOTELEMETRYDIR='/home/trond/.config/go/telemetry'
	GCCGO='gccgo'
	GOAMD64='v1'
	AR='ar'
	CC='gcc'
	CXX='g++'
	CGO_ENABLED='1'
	GOMOD='/home/trond/MODULE/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3014545004=/tmp/go-build -gno-record-gcc-switches'

Share the Go related settings you have added/edited

    "go.lintTool": "golangci-lint",

Describe the bug

When installing golangci-lint v1.60.1 with the method recommended on the official website, its version ends up being reported as (devel). Because of this check, introduced in 5e6ba19, the extension ends up assuming v2, and supplying the wrong flags:

version = !moduleVersion || moduleVersion.startsWith('v1') ? 1 : 2;

The following output ends up in the output view, indicating that the extension chose version 2:

2025-08-20 08:54:33.111 [info] Running checks...
2025-08-20 08:54:33.126 [info] Starting linting the current package at /PATH/TO/MY/PACKAGE
2025-08-20 08:54:33.189 [error] Error while running tool: /home/trond/go/bin/golangci-lint run --issues-exit-code=0 --output.text.print-issued-lines=false --show-stats=false --output.text.path=stdout --path-mode=abs
2025-08-20 08:54:33.189 [error] Error: unknown flag: --output.text.print-issued-lines
Failed executing command with error: unknown flag: --output.text.print-issued-lines

Steps to reproduce the behavior:

  1. Install golangci-lint v1.60.1 as described in the "Local installation" instructions in the official documentation:
    curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1
    
  2. Open a golang file in VS Code
  3. Go to the Go output window, observe the error printed above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions