golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.78k stars 727 forks source link

Linter settings ignored #3396

Closed andig closed 1 month ago

andig commented 1 month ago

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
hyangah commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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.