-
-
Notifications
You must be signed in to change notification settings - Fork 47
fix: migrate to golangci-lint v2 #779
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # https://golangci-lint.run/usage/configuration/ | ||
| version: "2" | ||
| linters-settings: | ||
| govet: | ||
| check-shadowing: true | ||
| misspell: | ||
| locale: US | ||
| errcheck: | ||
| check-type-assertions: false | ||
| check-blank: false | ||
|
|
||
| linters: | ||
| default: none | ||
| enable: | ||
| - govet | ||
| - misspell | ||
| - errcheck | ||
| exclusions: | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
|
Comment on lines
+18
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| formatters: | ||
| default: none | ||
|
|
||
| issues: | ||
| max-same-issues: 0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ jobs: | |
| golangci-lint: | ||
| name: runner / golangci-lint | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| golangci-lint-version: ["v1", "v2"] | ||
| steps: | ||
| - name: Check out code into the Go module directory | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
@@ -15,14 +18,16 @@ jobs: | |
| with: | ||
| github_token: ${{ secrets.github_token }} | ||
| level: warning | ||
| golangci_lint_flags: "--config=.github/.golangci.yml ./testdata" | ||
| golangci_lint_version: ${{ matrix.golangci-lint-version == 'v1' && 'v1.64.8' || 'latest' }} | ||
| golangci_lint_flags: "--config=.github/.golangci.${{ matrix.golangci-lint-version }}.yml ./testdata" | ||
|
|
||
| golangci-lint-platform: | ||
| name: runner / golangci-lint-platform | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| platform: [ubuntu-latest, macos-latest, windows-latest] | ||
| golangci-lint-version: ["v1", "v2"] | ||
| runs-on: ${{ matrix.platform }} | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
@@ -32,7 +37,8 @@ jobs: | |
| github_token: ${{ secrets.github_token }} | ||
| tool_name: golangci-lint-${{ matrix.platform }} | ||
| level: warning | ||
| golangci_lint_flags: "--config=.github/.golangci.yml ./testdata --timeout 10m" | ||
| golangci_lint_version: ${{ matrix.golangci-lint-version == 'v1' && 'v1.64.8' || 'latest' }} | ||
| golangci_lint_flags: "--config=.github/.golangci.${{ matrix.golangci-lint-version }}.yml ./testdata --timeout 10m" | ||
|
|
||
| golangci-lint-github-pr-review: | ||
| name: runner / golangci-lint (github-pr-review) | ||
|
|
@@ -88,7 +94,7 @@ jobs: | |
| github_token: ${{ secrets.github_token }} | ||
| tool_name: "golangci-lint-all-in-one" | ||
| level: warning | ||
| golangci_lint_flags: "--enable-all --exclude-use-default=false ./testdata" | ||
| golangci_lint_flags: "--default all ./testdata" | ||
|
|
||
| govet: | ||
| name: runner / govet | ||
|
|
@@ -100,7 +106,7 @@ jobs: | |
| uses: ./ | ||
| with: | ||
| github_token: ${{ secrets.github_token }} | ||
| golangci_lint_flags: "--disable-all -E govet ./testdata" | ||
| golangci_lint_flags: "--default none -E govet ./testdata" | ||
| tool_name: govet | ||
|
|
||
| staticcheck: | ||
|
|
@@ -113,23 +119,9 @@ jobs: | |
| uses: ./ | ||
| with: | ||
| github_token: ${{ secrets.github_token }} | ||
| golangci_lint_flags: "--disable-all -E staticcheck ./testdata" | ||
| golangci_lint_flags: "--default none -E staticcheck ./testdata" | ||
| tool_name: staticcheck | ||
|
|
||
| golint: | ||
| name: runner / golint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code into the Go module directory | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| - name: golint | ||
| uses: ./ | ||
| with: | ||
| github_token: ${{ secrets.github_token }} | ||
| golangci_lint_flags: "--disable-all -E golint ./testdata" | ||
| tool_name: golint | ||
| level: warning | ||
|
|
||
|
Comment on lines
-119
to
-132
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 https://golangci-lint.run/product/migration-guide/#deprecated-linters |
||
| errcheck: | ||
| name: runner / errcheck | ||
| runs-on: ubuntu-latest | ||
|
|
@@ -140,7 +132,7 @@ jobs: | |
| uses: ./ | ||
| with: | ||
| github_token: ${{ secrets.github_token }} | ||
| golangci_lint_flags: "--disable-all -E errcheck ./testdata" | ||
| golangci_lint_flags: "--default none -E errcheck ./testdata" | ||
| tool_name: errcheck | ||
| level: warning | ||
|
|
||
|
|
@@ -154,7 +146,7 @@ jobs: | |
| uses: ./ | ||
| with: | ||
| github_token: ${{ secrets.github_token }} | ||
| golangci_lint_flags: "--disable-all -E misspell ./testdata" | ||
| golangci_lint_flags: "--default none -E misspell ./testdata" | ||
| tool_name: misspell | ||
| level: info | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { isGolangciLintV1 } from "../src/main"; | ||
|
|
||
| describe("isV1", () => { | ||
| it("should return false if the version is latest", () => { | ||
| expect(isGolangciLintV1("latest")).toBe(false); | ||
| }); | ||
|
|
||
| it("should return true if the version is v1.x.x", () => { | ||
| expect(isGolangciLintV1("v1.0.0")).toBe(true); | ||
| }); | ||
|
|
||
| it("should return true if the version is v2.x.x", () => { | ||
| expect(isGolangciLintV1("v2.0.0")).toBe(false); | ||
| }); | ||
| }); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 https://golangci-lint.run/product/migration-guide/#lintersdisable-all