Skip to content

Commit 03adb07

Browse files
committed
ci: add golangci-lint GitHub workflow
1 parent 8924ee0 commit 03adb07

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: golangci-lint
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
golangci:
14+
name: lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Get go version from go.mod
21+
run: |
22+
echo "GO_VERSION=$(grep '^go ' go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
23+
24+
- name: Setup-go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: ${{ env.GO_VERSION }}
28+
29+
- name: Run golangci-lint
30+
uses: golangci/golangci-lint-action@v7
31+
with:
32+
version: v2.1.5

.golangci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
version: "2"
2+
run:
3+
timeout: 2m
4+
linters:
5+
default: none
6+
enable:
7+
- dupl
8+
- errcheck
9+
- funlen
10+
- goconst
11+
- gocritic
12+
- gocyclo
13+
- gosec
14+
- govet
15+
- ineffassign
16+
- lll
17+
- misspell
18+
- nolintlint
19+
- prealloc
20+
- revive
21+
- staticcheck
22+
- thelper
23+
- tparallel
24+
- unconvert
25+
- unparam
26+
- unused
27+
settings:
28+
thelper:
29+
test:
30+
begin: false
31+
exclusions:
32+
generated: lax
33+
presets:
34+
- comments
35+
- common-false-positives
36+
- legacy
37+
- std-error-handling
38+
rules:
39+
- linters:
40+
- funlen
41+
- unparam
42+
path: _test\.go
43+
paths:
44+
- third_party$
45+
- builtin$
46+
- examples$
47+
formatters:
48+
enable:
49+
- gci
50+
- gofmt
51+
- goimports
52+
exclusions:
53+
generated: lax
54+
paths:
55+
- third_party$
56+
- builtin$
57+
- examples$

cmd/wifiqr/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ the command line, the user will be prompted for the information.`,
199199
Version: version,
200200
}
201201

202-
rootCmd.Run = func(cmd *cobra.Command, args []string) {
202+
rootCmd.Run = func(_ *cobra.Command, _ []string) {
203203
keySet = rootCmd.Flags().Changed(optionKey)
204204

205205
exitVal = process(ssid, protocolIn, output, pixels, key, keySet, hidden)

cmd/wifiqr/main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func byteString(b [32]byte) string {
2222
return s + " }"
2323
}
2424

25+
//nolint:gosec
2526
func Test_generateCode(t *testing.T) {
2627
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
2728

0 commit comments

Comments
 (0)