Skip to content
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

Should not lint with staticcheck if it is enabled in gopls #1867

Closed
GAZ082 opened this issue Oct 31, 2021 · 8 comments
Closed

Should not lint with staticcheck if it is enabled in gopls #1867

GAZ082 opened this issue Oct 31, 2021 · 8 comments

Comments

@GAZ082
Copy link

GAZ082 commented Oct 31, 2021

I added this to my user settings:

    "gopls": {
        "staticcheck": true,
        "ui.diagnostic.analyses": {
            "U1000":false
        }
	}

And Im still getting U1000 warnings.

VSCODE:
Version: 1.61.2
Commit: 6cba118ac49a1b88332f312a8f67186f7f3c1643
Date: 2021-10-19T14:58:13.605Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.12.18-1-ck-nehalem

Extension:
Id: golang.go
Version: 0.29.0
@gopherbot gopherbot added this to the Untriaged milestone Oct 31, 2021
@suzmue
Copy link
Contributor

suzmue commented Nov 1, 2021

@GAZ082 Could you please include the gopls output (found by navigating to View -> Output -> Tasks -> gopls (server)) to confirm what is happening?

I was able to reproduce and this happens in my repro case because the extension is still running staticcheck for diagnostics separately from gopls. These configurations for "gopls" are not applied to staticcheck when the extension runs it separately.

@suzmue suzmue added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 1, 2021
@GAZ082
Copy link
Author

GAZ082 commented Nov 1, 2021

@suzmue
Hey suz, sure:

[Info  - 7:59:16 PM] 2021/11/01 19:59:16 go env for /home/ga082/projects/someProject/backend
(root /home/ga082/projects/someProject/backend)
(go version go version go1.17.2 linux/amd64)
(valid build configuration = true)
(build flags: [])
GOROOT=/usr/lib/go
GO111MODULE=
GOPROXY=https://proxy.golang.org,direct
GOSUMDB=sum.golang.org
GOMOD=/home/ga082/projects/someProject/backend/go.mod
GONOPROXY=
GOPATH=/home/ga082/go
GOPRIVATE=
GONOSUMDB=
GOCACHE=/home/ga082/.cache/go-build
GOFLAGS=
GOINSECURE=
GOMODCACHE=/home/ga082/go/pkg/mod


[Info  - 7:59:16 PM] 2021/11/01 19:59:16 go/packages.Load
	snapshot=0
	directory=/home/ga082/projects/someProject/backend
	query=[builtin someProject/backend/...]
	packages=38

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 falling back to safe trimming due to type errors: [/usr/lib/go/src/runtime/vdso_linux.go:55:38: invalid operation: division by zero /usr/lib/go/src/runtime/vdso_linux.go:56:38: invalid operation: division by zero] or still-missing identifiers: map[memRecordCycle:true pageBits:true]
	package="runtime"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 falling back to safe trimming due to type errors: [/usr/lib/go/src/os/user/cgo_lookup_unix.go:200:19: int not declared by package C /usr/lib/go/src/os/user/cgo_lookup_unix.go:203:16: bufferKind(C._SC_GETPW_R_SIZE_MAX) (value of type bufferKind) is not constant /usr/lib/go/src/os/user/cgo_lookup_unix.go:204:16: bufferKind(C._SC_GETGR_R_SIZE_MAX) (value of type bufferKind) is not constant] or still-missing identifiers: map[]
	package="os/user"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 falling back to safe trimming due to type errors: [/home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:12:13: int not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:13:13: uint not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:14:13: float not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:15:13: double not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:16:13: size_t not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:18:15: uint8_t not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:19:15: uint16_t not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:20:15: uint32_t not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:21:15: uint64_t not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:23:14: int8_t not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:24:14: int16_t not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:25:14: int32_t not declared by package C /home/ga082/go/pkg/mod/github.com/chai2010/webp@v1.1.0/cgo.go:26:14: int64_t not declared by package C] or still-missing identifiers: map[]
	package="github.com/chai2010/webp"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 discovered missing identifiers: map[yaml_style_t:true]
	package="gopkg.in/yaml.v2"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 discovered missing identifiers: map[encoder:true]
	package="image/png"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 discovered missing identifiers: map[cpuMask:true]
	package="golang.org/x/sys/unix"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 discovered missing identifiers: map[options:true]
	package="vendor/golang.org/x/text/unicode/bidi"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 discovered missing identifiers: map[options:true]
	package="golang.org/x/text/unicode/bidi"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 discovered missing identifiers: map[matcher:true]
	package="golang.org/x/text/language"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 discovered missing identifiers: map[pguint32:true]
	package="github.com/jackc/pgtype"

[Info  - 7:59:17 PM] 2021/11/01 19:59:17 discovered missing identifiers: map[message:true]
	package="internal/profile"

[Info  - 7:59:47 PM] 2021/11/01 19:59:47 background imports cache refresh starting

[Info  - 7:59:47 PM] 2021/11/01 19:59:47 background refresh finished after 308.079729ms

@GAZ082
Copy link
Author

GAZ082 commented Nov 1, 2021

@suzmue also removed a binary of staticcheck in $GOPATH/bin, no luck.

@suzmue
Copy link
Contributor

suzmue commented Nov 5, 2021

@GAZ082 Thanks for the information!

Could you try reloading vscode to make sure that you are not receiving any cached diagnostics, and then take a screenshot of the diagnostic you are seeing?

@GAZ082
Copy link
Author

GAZ082 commented Nov 5, 2021

@suzmue

image

@suzmue
Copy link
Contributor

suzmue commented Nov 5, 2021

These appear to all be coming from the staticcheck command line tool.

These should be disabled when gopls is using staticcheck. This is a bug in the extension.

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/361794 mentions this issue: src/goTools.ts: disable lint tool if 'staticcheck' is true

@suzmue suzmue removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 5, 2021
@suzmue suzmue modified the milestones: Untriaged, On Deck Nov 5, 2021
@suzmue suzmue changed the title Staticcheck ignore analyses not working. Should not lint with staticcheck if it is enabled in gopls Nov 5, 2021
@hyangah
Copy link
Contributor

hyangah commented Nov 5, 2021

The recommended way of setting staticcheck of gopls is

  "gopls": {
     "ui.diagnostic.staticcheck": true
  }

@hyangah hyangah modified the milestones: On Deck, v0.30.0 Dec 9, 2021
@golang golang locked and limited conversation to collaborators Dec 9, 2022
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

4 participants