Skip to content

Linter settings ignored #3396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andig opened this issue May 20, 2024 · 9 comments
Closed

Linter settings ignored #3396

andig opened this issue May 20, 2024 · 9 comments

Comments

@andig
Copy link

andig commented May 20, 2024

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.
    • go version go1.22.3 darwin/arm64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls v0.15.3
    golang.org/x/tools/gopls@v0.15.3 h1:zbdOidFrPTc8Bx0YrN5QKgJ0zCjyGi0L27sKQ/bDG5o=
    github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/go-cmp@v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/mod@v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
    golang.org/x/sync@v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
    golang.org/x/telemetry@v0.0.0-20240209200032-7b892fcb8a78 h1:vcVnuftN4J4UKLRcgetjzfU9FjjgXUUYUc3JhFplgV4=
    golang.org/x/text@v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
    golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217 h1:uH9jJYgeLCvblH0S+03kFO0qUDxRkbLRLFiKVVDl7ak=
    golang.org/x/vuln@v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU=
    honnef.co/go/tools@v0.4.6 h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8=
    mvdan.cc/gofumpt@v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
    mvdan.cc/xurls/v2@v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
go: go1.22.2
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
Version: 1.89.1 (Universal)
Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685
Date: 2024-05-07T05:14:24.611Z (1 wk ago)
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.4.0
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.41.4
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
# Tools Configuration


## Environment

GOBIN: undefined
toolsGopath: 
gopath: /Users/andig/go
GOROOT: /opt/homebrew/Cellar/go/1.22.3/libexec
PATH: /opt/homebrew/opt/ruby/bin:/Users/andig/go/bin:/opt/homebrew/opt/node@16/bin:/Users/andig/go/bin:/opt/homebrew/bin/go:/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/munki:

## Tools

	go:	/opt/homebrew/bin/go: go version go1.22.3 darwin/arm64

	gopls:	/Users/andig/go/bin/gopls	(version: v0.15.3 built with go: go1.22.2)
	gotests:	/Users/andig/go/bin/gotests	(version: v1.6.0 built with go: go1.22.0)
	gomodifytags:	/Users/andig/go/bin/gomodifytags	(version: v1.16.0 built with go: go1.22.0)
	impl:	/Users/andig/go/bin/impl	(version: v1.1.0 built with go: go1.22.0)
	goplay:	/Users/andig/go/bin/goplay	(version: v1.0.0 built with go: go1.22.0)
	dlv:	/Users/andig/go/bin/dlv	(version: v1.22.0 built with go: go1.22.0)
	golangci-lint:	/Users/andig/go/bin/golangci-lint	(version: v1.58.1 built with go: go1.22.0)

## Go env

Workspace Folder (evcc): /Users/andig/htdocs/evcc

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/evcc/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build3117074602=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (evcc-tesla): /Users/andig/htdocs/evcc-tesla

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/evcc-tesla/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build751096580=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (gosunspec): /Users/andig/htdocs/gosunspec

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/gosunspec/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build3754466018=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (evcc-packages): /Users/andig/htdocs/evcc-packages

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/evcc-packages/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build2491276322=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (evcc-sponsor): /Users/andig/htdocs/evcc-sponsor

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/evcc-sponsor/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build3894424879=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (evcc-consul): /Users/andig/htdocs/evcc-consul

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/evcc-consul/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build2342564626=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (mermaid): /Users/andig/htdocs/mermaid

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build556645449=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (rct): /Users/andig/htdocs/rct

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/rct/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build3682454570=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (mbmd): /Users/andig/htdocs/mbmd

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/mbmd/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build2002791817=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (gridx-modbus): /Users/andig/htdocs/gridx-modbus

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/gridx-modbus/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build1572668131=/tmp/go-build -gno-record-gcc-switches -fno-common'
	
Workspace Folder (evcc-modbus): /Users/andig/htdocs/evcc-modbus

	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andig/Library/Caches/go-build'
	GOENV='/Users/andig/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andig/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andig/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.22.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.3/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.22.3'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/Users/andig/htdocs/evcc-modbus/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build1439468996=/tmp/go-build -gno-record-gcc-switches -fno-common'

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

User settings:

"go.gopath": "~/go",
"go.useLanguageServer": true,
"gopls": {
    "formatting.gofumpt": true,
    "zeroConfig": false,
},
"go.languageServerFlags": [
    "serve",
    "-rpc.trace",
    "--debug=localhost:6060"
],

Workspace settings:

	"go.buildTags": "eebus",
	"go.testTags": "eebus",
	"git.ignoreLimitWarning": true,
	"vue.features.codeActions.enable": false,
	"go.lintTool": "golangci-lint",
	"go.lintFlags": [
		"-c",
		".golangci.yml"
	],

Describe the bug

According to workspace, golangci-lint is the linter of choice. .golangci.yml looks like this:

run:
  go: "1.22"

issues:
  exclude:
    - .regActualCurrent. is unused
    - "`routeLogger` is unused"

linters-settings:
  staticcheck:
    checks:
      - "-SA1019"

linters:
  disable-all: true
  enable:
    - dogsled
    - durationcheck
    - gci
    - gofmt
    - goimports
    - goprintffuncname
    - govet
    - importas
    - ineffassign
    - makezero
    - misspell
    - nolintlint
    - rowserrcheck
    - sqlclosecheck
    - staticcheck
    - tparallel
    - typecheck
    - unconvert
    - unused
    - wastedassign
    - whitespace

    # fixme
    # - bodyclose
    # - exhaustive
    # - exportloopref
    # - gocritic
    # - godot
    # - gomoddirectives
    # - nakedret
    # - nilerr
    # - noctx
    # - prealloc
    # - predeclared
    # - revive
    # - stylecheck
    # - unparam
    # - dupl

loopclosure is disabled. Still, I see loopclosure errors (screenshot below). It seems linter settings are ignored.

Steps to reproduce the behavior:

Open workspace, look at output.

Screenshots or recordings

Screenshot 2024-05-20 at 12 49 15
@gopherbot gopherbot added this to the Untriaged milestone May 20, 2024
@hyangah
Copy link
Contributor

hyangah commented May 20, 2024

That warning came from the gopls. If it was from golangci-lint, you should see "golangci-lint" in the diagnostics info instead of loopclosure(default).

Disable it uisng https://github.com/golang/vscode-go/wiki/settings#uidiagnosticanalyses

@andig
Copy link
Author

andig commented May 20, 2024

So it really is a gopls issue in terms of gopls looking at other settings? It would imho make sense if gopls and the vscode plugin were using the same settings?

@hyangah
Copy link
Contributor

hyangah commented May 20, 2024

No, neither gopls nor vscode-go plugin will try to parse/understand 3rd party linter configuration.
Configure your editor setting to disable the analyzer in gopls. It's unfortunate that you need to maintain two configs.

BTW, I thought loopclosure analyzer has a low false positive rate so it's enabled by default.
Are you trying to suppress it because you think this is incorrect diagnostic? If so, we should file an issue and fix the analyzer.

@andig
Copy link
Author

andig commented May 21, 2024

It's unfortunate that you need to maintain two configs.

Indeed. It would be nice if gopls and vscode-go would share the same underlying setting.

Are you trying to suppress it because you think this is incorrect diagnostic?

loopclosure is no longer needed on Go 1.22. Afaiu it does not detect the go version and will hence raise false positives on later go versions.

@timothy-king
Copy link

loopclosure is no longer needed on Go 1.22. Afaiu it does not detect the go version and will hence raise false positives on later go versions.

loopclosure looks at the GoVersion of the file. To over simplify, this is version in the go.mod file for the module which can be overridden by build tags. loopclosure skips files if they are "known to come after language version 1.22". So if it is not the only analyzer you are running, it will be either be very fast, bordering on free, if your module is after 1.22. Or the file is <= 1.21 and it is relevant.

So I don't think you gain much by selectively turning it off.

(The big caveat is if you are seeing false positives due to actual problems with "known to come after language version 1.22". That is mostly likely an issue with plumbing the GoVersion correctly to go/types in the tool though.)

@andig
Copy link
Author

andig commented May 21, 2024

Seems this is turning into a loopclosure issue. Please feel to close if no longer appropriate.

loopclosure looks at the GoVersion of the file.

I have

go 1.22.0

in go.mod. Maybe I misunderstand the error message, but I wouldn't expect this linter hint on Go 1.22?

@timothy-king
Copy link

Maybe I misunderstand the error message, but I wouldn't expect this linter hint on Go 1.22?

Not unless you are specifying a lower GoVersion for the file using buildtags. There is also a chance that go versions are not being appropriately piped in gopls.

cc @findleyr

@andig
Copy link
Author

andig commented May 21, 2024

Not unless you are specifying a lower GoVersion for the file using buildtags.

I wasn't even aware that was possible. No version buildtags!

@findleyr
Copy link
Member

We're going to cut gopls@v0.15.4 anyway due to golang/go#67545. That release will include the fix to the loopclosure analyzer so that it properly detects go1.22.

@andig andig closed this as completed May 21, 2024
@golang golang locked and limited conversation to collaborators May 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants