Skip to content

Commit f351c51

Browse files
committed
updated workflows for linting
1 parent ae42614 commit f351c51

File tree

2 files changed

+173
-0
lines changed

2 files changed

+173
-0
lines changed

.github/workflows/lint.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint
2+
on: [ push, pull_request ]
3+
env:
4+
# Common versions
5+
GO_VERSION: '1.24.0'
6+
GOLANGCI_VERSION: 'v2.2.2'
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version: ${{ env.GO_VERSION }}
18+
cache: false # The golangci-lint action does its own caching.
19+
20+
- name: Check go mod tidy
21+
working-directory: ./api
22+
run: go mod tidy && git diff --exit-code go.mod go.sum
23+
24+
- name: Lint
25+
uses: golangci/golangci-lint-action@v7
26+
working-directory: ./api
27+
with:
28+
version: ${{ env.GOLANGCI_VERSION }}
29+

api/.golangci.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
version: "2"
2+
output:
3+
formats:
4+
text:
5+
path: stdout
6+
linters:
7+
enable:
8+
- asasalint
9+
- asciicheck
10+
- bidichk
11+
- bodyclose
12+
- contextcheck
13+
- durationcheck
14+
- errchkjson
15+
- errorlint
16+
- exhaustive
17+
- gocheckcompilerdirectives
18+
- gochecksumtype
19+
- goconst
20+
- gocritic
21+
- gocyclo
22+
- gosec
23+
- gosmopolitan
24+
- loggercheck
25+
- makezero
26+
- misspell
27+
- musttag
28+
- nakedret
29+
- nilerr
30+
- nilnesserr
31+
- noctx
32+
- nolintlint
33+
- prealloc
34+
- protogetter
35+
- reassign
36+
- recvcheck
37+
- revive
38+
- rowserrcheck
39+
- spancheck
40+
- sqlclosecheck
41+
- testifylint
42+
- unconvert
43+
- unparam
44+
- zerologlint
45+
settings:
46+
dupl:
47+
threshold: 100
48+
errcheck:
49+
check-type-assertions: false
50+
check-blank: false
51+
exclude-functions:
52+
- io/ioutil.ReadFile
53+
goconst:
54+
min-len: 3
55+
min-occurrences: 5
56+
gocritic:
57+
enabled-tags:
58+
- performance
59+
settings:
60+
captLocal:
61+
paramsOnly: true
62+
rangeValCopy:
63+
sizeThreshold: 32
64+
gocyclo:
65+
min-complexity: 10
66+
govet:
67+
disable:
68+
- shadow
69+
lll:
70+
tab-width: 1
71+
nakedret:
72+
max-func-lines: 30
73+
nolintlint:
74+
require-explanation: true
75+
require-specific: true
76+
prealloc:
77+
simple: true
78+
range-loops: true
79+
for-loops: false
80+
unparam:
81+
check-exported: false
82+
exclusions:
83+
generated: lax
84+
rules:
85+
- linters:
86+
- all
87+
path: zz_generated\..+\.go$
88+
- linters:
89+
- dupl
90+
- errcheck
91+
- gocyclo
92+
- gosec
93+
- scopelint
94+
- unparam
95+
path: _test(ing)?\.go
96+
- linters:
97+
- gocritic
98+
path: _test\.go
99+
text: (unnamedResult|exitAfterDefer)
100+
- linters:
101+
- gocritic
102+
text: '(hugeParam|rangeValCopy):'
103+
- linters:
104+
- staticcheck
105+
text: 'SA3000:'
106+
- linters:
107+
- gosec
108+
text: 'G101:'
109+
- linters:
110+
- gosec
111+
text: 'G104:'
112+
- linters:
113+
- musttag
114+
path: k8s.io/
115+
paths:
116+
- third_party$
117+
- builtin$
118+
- examples$
119+
issues:
120+
max-issues-per-linter: 0
121+
max-same-issues: 0
122+
new: false
123+
formatters:
124+
enable:
125+
- gci
126+
- gofmt
127+
settings:
128+
gci:
129+
sections:
130+
- standard
131+
- default
132+
- prefix(github.com/crossplane)
133+
- prefix(github.com/crossplane-contrib)
134+
- blank
135+
- dot
136+
custom-order: true
137+
gofmt:
138+
simplify: true
139+
exclusions:
140+
generated: lax
141+
paths:
142+
- third_party$
143+
- builtin$
144+
- examples$

0 commit comments

Comments
 (0)