josa42 / coc-go

Go language server extension using gopls for coc.nvim.
MIT License
566 stars 30 forks source link

staticcheck isn't installed and it seems to not working when I install it #220

Open metal3d opened 7 months ago

metal3d commented 7 months ago

Hi, at first: Thanks!

I've got something weird (didn't tried on my Fedora system, only on the WSL2), it seems that coc-go doesn't install staticcheck tool.

And if I install it myself with: go install honnef.co/go/tools/cmd/staticcheck@latest the tool is in my PATH but it is never used by coc-go.

My gopls config is here:

"go.goplsOptions": {
    "usePlaceholders": true,
    "staticcheck": true,
    "hoverKind": "FullDocumentation"
  },

GoPLS works it seems, but staticcheck doesn't complain about a function that is never used for example.

Any help ?

Note: I also tried to copy the staticcheck binary to the coc-go bin folder:

ls ~/.config/coc/extensions/coc-go-data/bin/
gomodifytags  goplay  gopls  gotests  impl  staticcheck

this doesn't change anything.

metal3d commented 7 months ago

Tested on Fedora now.

OK, it seems to work for STxxx problems, but not for Uxxx checks.

On command line:

staticcheck ./...
generator/volume.go:121:6: func valueOrDefault is unused (U1000)
update/main.go:60:19: error strings should not be capitalized (ST1005)
update/main.go:65:19: error strings should not be capitalized (ST1005)
update/main.go:72:19: error strings should not be capitalized (ST1005)
update/main.go:120:10: error strings should not be capitalized (ST1005)

As you can see, it is only OK for update/main.go checks: image

But on generator/volume.go, no checks explain that the function is unused:

image

Is there a configuration that I missed?