Skip to content

Commit 6dd333a

Browse files
authored
Merge pull request #790 from reviewdog/add_validation_4
Add CI to check golintci-lint config
2 parents d3999a6 + 852bdfb commit 6dd333a

File tree

3 files changed

+41
-14
lines changed

3 files changed

+41
-14
lines changed

.github/.golangci.v1.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# https://golangci-lint.run/usage/configuration/
22
linters-settings:
33
govet:
4-
check-shadowing: true
5-
golint:
6-
min-confidence: 0
4+
enable:
5+
- shadow
76
misspell:
87
locale: US
98
errcheck:

.github/.golangci.v2.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
# https://golangci-lint.run/usage/configuration/
22
version: "2"
3-
linters-settings:
4-
govet:
5-
check-shadowing: true
6-
misspell:
7-
locale: US
8-
errcheck:
9-
check-type-assertions: false
10-
check-blank: false
113

124
linters:
135
default: none
146
enable:
157
- govet
168
- misspell
179
- errcheck
10+
settings:
11+
govet:
12+
enable:
13+
- shadow
14+
misspell:
15+
locale: US
16+
errcheck:
17+
check-type-assertions: false
18+
check-blank: false
1819
exclusions:
1920
presets:
2021
- comments
2122
- common-false-positives
2223
- legacy
2324
- std-error-handling
2425

25-
formatters:
26-
default: none
27-
2826
issues:
2927
max-same-issues: 0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: check golangci-lint config
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
golangci-lint-version: ["v1", "v2"]
14+
steps:
15+
- name: Check out code into the Go module directory
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
- name: Set TAG_NAME
18+
if: ${{ matrix.golangci-lint-version == 'v1' }}
19+
run: echo "TAG_NAME=v1.64.8" >> "$GITHUB_ENV"
20+
- name: Set TAG_NAME
21+
if: ${{ matrix.golangci-lint-version != 'v1' }}
22+
env:
23+
GH_TOKEN: ${{ secrets.github_token }}
24+
run: echo "TAG_NAME=$(gh release list --repo golangci/golangci-lint --json name,isLatest --jq '.[] | select(.isLatest) | .name')" >> "$GITHUB_ENV"
25+
- name: Install golangci-lint
26+
run: |
27+
curl -sSfL "https://raw.githubusercontent.com/golangci/golangci-lint/refs/tags/$TAG_NAME/install.sh" | sh -s -- -b "$(go env GOPATH)/bin" "$TAG_NAME"
28+
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
29+
- name: Validate golangci-lint config
30+
run: golangci-lint config verify --config=.github/.golangci.${{ matrix.golangci-lint-version }}.yml

0 commit comments

Comments
 (0)