Conversation
b6c9093 to
7a86e4d
Compare
7a86e4d to
0aa0c60
Compare
| staticcheck: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: stable | ||
|
|
||
| - name: Clone repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up staticcheck | ||
| run: go install honnef.co/go/tools/cmd/staticcheck@latest | ||
|
|
||
| - name: Run staticcheck | ||
| run: staticcheck ./... | ||
|
|
There was a problem hiding this comment.
Why remove it? Does new golang-ci-lint v2 include staticcheck?
There was a problem hiding this comment.
Yes it's included. https://golangci-lint.run/usage/linters/#enabled-by-default
There was a problem hiding this comment.
Just FYI, the staticcheck linter in Golangci-lint V1 is not the same as the standalone Staticcheck linter. The V1 docs included an additional statement that says (golangci/golangci-lint#2894):
It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.
This statement has been removed in V2.
In V1, stylecheck, gosimple, and staticcheck cover the 4 options of the standalone Staticcheck linter. They have been merged in golangci/golangci-lint#5487, that means the staticcheck in Golangci-lint V2 now actually works like the standalone Staticcheck linter.
There was a problem hiding this comment.
thanks for the context!
I think with v2 we should be safe unless I'm missing something?
.golangci.yaml
Outdated
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
| formatters: | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ |
There was a problem hiding this comment.
Did you copy this config from somewhere else? Because we only have the examples directory https://github.com/urfave/cli/tree/main/examples
Since our examples code are minimal, I think we should be able to include them in the linter too and not cause any errors. What do you think?
There was a problem hiding this comment.
This was auto-generated by golangci-lint migrate. I think right now it passes lint, so we can keep it like that.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
`actions/setup-go` uses `go.sum` file as the cache key. The CI needs to clone the repository first in order to restore the cache properly. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
| - name: Clone repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: stable | ||
|
|
||
| - name: Clone repository | ||
| uses: actions/checkout@v4 | ||
|
|

What type of PR is this?
What this PR does / why we need it:
Bumps to golangci-lint v2.
Which issue(s) this PR fixes:
None
Special notes for your reviewer:
(fill-in or delete this section)
Testing
(fill-in or delete this section)
Release Notes
(REQUIRED)