atc0005 / todo

A collection of TODO items not specific to any one project
MIT License
0 stars 0 forks source link

golangci-lint is not reporting issues that golint catches #29

Closed atc0005 closed 2 years ago

atc0005 commented 4 years ago

See also https://github.com/atc0005/todo/issues/9#issuecomment-620505235

While working on another project, I used a VSCode instance within a VM that did not have golangci-lint installed, and so defaulted to using golint for linting. It caught these issues that golangci-lint didn't report:

$ golint ./... | grep -v vendor
cmd/pkg1/constants.go:19:7: exported const MB should have comment or be unexported
cmd/pkg2/main.go:38:6: exported type AppConfig should have comment or be unexported
cmd/pkg3/main.go:32:6: exported type Results should have comment or be unexported
events/validate.go:24:1: exported function ValidatePayload should have comment or be unexported

I substituted the real package names with placeholders, but the rest is untouched.

Here is the entries in the .golangci.yml file:

linters:
  enable:
    - dogsled
    - goimports
    - gosec
    - stylecheck
    - goconst
    - depguard
    - prealloc
    - misspell
    - maligned
    - dupl
    - unconvert
    - gofmt
    - golint
    - gocritic
    - scopelint

This is with golangci-lint v1.28.3.

atc0005 commented 4 years ago

Rolling back to v1.25.0 didn't change anything.

atc0005 commented 4 years ago

Until I can figure this out, I might need to bring back the standalone golint command:

golint -set_exit_status $(go list -mod=vendor ./... | grep -v /vendor/)
atc0005 commented 4 years ago

Opened bug report:

https://github.com/golangci/golangci-lint/issues/1249

For now, I'll add back the golint command until this can be sorted.

atc0005 commented 4 years ago

As noted in the golangci-lint GH issue and on atc0005/brick#113, the "problem" is that some linting checks are disabled by default due to their high false-positive rate. You have to explicitly re-enable those checks.

atc0005/brick#113 did so for the atc0005/brick project. Other projects will need similar changes to run the (currently) disabled checks.

Yet another reason to push forward with the use of a custom Docker container for linting my Go projects.