Skip to content

Commit 861fdfb

Browse files
committed
ci: bump golangci-lint to v2 and fix Windows lint
Signed-off-by: Mark Tsai <111229657+shuan1026@users.noreply.github.com>
1 parent a312ce9 commit 861fdfb

3 files changed

Lines changed: 41 additions & 7 deletions

File tree

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# ensure that line endings for Windows builds are properly formatted
2+
# see https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#how-to-use
3+
# at "Multiple OS Example" section
4+
*.go text eol=lf

.github/workflows/tests.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ jobs:
4646
exit 1
4747
;;
4848
esac
49-
- name: golangci-lint
50-
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
49+
- name: Run golangci-lint
50+
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
5151
with:
52-
version: v1.64.8
52+
version: v2.10.1
5353

5454
test-windows:
5555
strategy:
@@ -87,10 +87,6 @@ jobs:
8787
;;
8888
esac
8989
shell: bash
90-
- name: golangci-lint
91-
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
92-
with:
93-
version: v1.64.8
9490

9591
coverage:
9692
needs: ["test-linux", "test-windows"]

.golangci.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
formatters:
2+
enable:
3+
- gofmt
4+
issues:
5+
max-same-issues: 0
6+
linters:
7+
default: none
8+
enable: # please keep this alphabetized
9+
- errcheck
10+
- govet
11+
- ineffassign
12+
- staticcheck
13+
- unused
14+
exclusions:
15+
presets:
16+
- comments
17+
- common-false-positives
18+
- legacy
19+
- std-error-handling
20+
settings: # please keep this alphabetized
21+
staticcheck:
22+
checks:
23+
- all
24+
- -QF1003 # Convert if/else-if chain to tagged switch
25+
- -QF1004 # Use strings.ReplaceAll instead of strings.Replace with n == -1
26+
- -QF1008 # Omit embedded fields from selector expression
27+
- -QF1010 # Convert slice of bytes to string when printing it
28+
- -QF1011 # Omit redundant type from variable declaration
29+
- -ST1003 # Poorly chosen identifier
30+
- -ST1005 # Incorrectly formatted error string
31+
- -ST1006 # Poorly chosen receiver name
32+
- -ST1012 # Poorly chosen name for error variable
33+
- -ST1016 # Use consistent method receiver names
34+
version: "2"

0 commit comments

Comments
 (0)