Skip to content

Commit 351e7b2

Browse files
authored
Add golangci-lint workflow (#95)
Add `golangci-lint` workflow. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent 2e023fa commit 351e7b2

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: golangci-lint
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- '**/*.go'
8+
push:
9+
paths:
10+
- '**/*.go'
11+
schedule:
12+
- cron: 0 0 * * 0
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
- name: Setup Go
24+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
25+
with:
26+
go-version-file: go.mod
27+
cache: true
28+
- name: Download Go Modules
29+
run: go mod download
30+
- name: Build
31+
run: go build -v .
32+
- name: Run Linters
33+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
34+
with:
35+
version: latest

.golangci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
version: "2"
3+
4+
output:
5+
formats:
6+
text:
7+
path: stdout
8+
9+
linters:
10+
default: none
11+
enable:
12+
- errcheck
13+
- gosec
14+
- govet
15+
- ineffassign
16+
- misspell
17+
- revive
18+
- staticcheck
19+
- unconvert
20+
- unused
21+
exclusions:
22+
generated: lax
23+
presets:
24+
- comments
25+
- common-false-positives
26+
- legacy
27+
- std-error-handling
28+
rules:
29+
# TODO: Setting temporary exclusions for specific linters.
30+
- linters:
31+
- errcheck
32+
text: is not checked
33+
- linters:
34+
- staticcheck
35+
text: QF1008
36+
- linters:
37+
- misspell
38+
text: is a misspelling
39+
- linters:
40+
- revive
41+
text: increment-decrement|redefines-builtin-id|unused-parameter|var-declaration|var-naming
42+
- linters:
43+
- unused
44+
text: is unused
45+
paths:
46+
- third_party$
47+
- builtin$
48+
- examples$
49+
50+
issues:
51+
max-same-issues: 0
52+
53+
formatters:
54+
enable:
55+
- gofmt
56+
- goimports
57+
exclusions:
58+
generated: lax
59+
paths:
60+
- third_party$
61+
- builtin$
62+
- examples$

0 commit comments

Comments
 (0)