Skip to content

Commit a45ed85

Browse files
committed
ci: update golangci-lint setup and version
1 parent 440fb31 commit a45ed85

File tree

5 files changed

+84
-36
lines changed

5 files changed

+84
-36
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ jobs:
5757
- name: golangci-lint
5858
uses: golangci/golangci-lint-action@v2
5959
with:
60-
version: v1.44.2
60+
version: v1.45.0
6161
args: --timeout 5m0s

.golangci.yml

Lines changed: 79 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
linters-settings:
2+
funlen:
3+
lines: 100
4+
statements: 50
5+
cyclop:
6+
skip-tests: true
7+
max-complexity: 30
8+
package-average: 5
9+
gocyclo:
10+
min-complexity: 15
11+
gofumpt:
12+
lang-version: "1.18"
13+
goimports:
14+
local-prefixes: github.com/golangci/golangci-lint
15+
goconst:
16+
min-len: 2
17+
min-occurrences: 3
18+
gocritic:
19+
enabled-tags:
20+
- diagnostic
21+
- experimental
22+
- opinionated
23+
- performance
24+
- style
25+
godot:
26+
capital: true
27+
gosimple:
28+
go: "1.18"
29+
checks: ["all"]
230
govet:
3-
check-shadowing: true
431
settings:
532
printf:
633
funcs:
@@ -9,35 +36,49 @@ linters-settings:
936
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
1037
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
1138
enable:
39+
- assign
40+
- atomic
41+
- atomicalign
42+
- bools
43+
- buildtag
44+
- cgocall
45+
- composites
46+
- copylocks
47+
- deepequalerrors
48+
- errorsas
1249
- fieldalignment
13-
gocyclo:
14-
min-complexity: 15
50+
- findcall
51+
- framepointer
52+
- httpresponse
53+
- ifaceassert
54+
- loopclosure
55+
- lostcancel
56+
- nilfunc
57+
- printf
58+
- reflectvaluecompare
59+
- shift
60+
- sigchanyzer
61+
- sortslice
62+
- stdmethods
63+
- stringintconv
64+
- structtag
65+
- testinggoroutine
66+
- tests
67+
- unmarshal
68+
- unreachable
69+
- unsafeptr
70+
- unusedresult
71+
1572
maligned:
1673
suggest-new: true
17-
goconst:
18-
min-len: 2
19-
min-occurrences: 2
2074
misspell:
2175
locale: UK
22-
lll:
23-
line-length: 140
24-
goimports:
25-
local-prefixes: github.com/golangci/golangci-lint
26-
gocritic:
27-
enabled-tags:
28-
- diagnostic
29-
- experimental
30-
- opinionated
31-
- performance
32-
- style
33-
disabled-checks:
34-
- wrapperFunc
35-
- dupImport # https://github.com/go-critic/go-critic/issues/845
36-
funlen:
37-
lines: 100
38-
statements: 50
39-
godot:
40-
capital: true
76+
staticcheck:
77+
go: "1.18"
78+
checks: ["all"]
79+
stylecheck:
80+
go: "1.18"
81+
checks: ["all"]
4182
unparam:
4283
check-exported: true
4384

@@ -51,27 +92,33 @@ issues:
5192
- govet
5293
- errcheck
5394
- forcetypeassert
95+
fix: true
96+
exclude-use-default: false
5497

5598
run:
99+
timeout: 5m
56100
skip-dirs:
57101
- model
58102
- tmp
59103
- bin
60104
- scripts
61-
105+
allow-parallel-runners: true
62106
tests: true
63107
build-tags:
64108
- integration
65109

66110
linters:
67111
enable:
112+
- bidichk
68113
- bodyclose
114+
- cyclop
69115
- deadcode
70116
- depguard
71117
- dogsled
72118
- dupl
73119
- durationcheck
74120
- errcheck
121+
- errname
75122
- errorlint
76123
- exportloopref
77124
- forcetypeassert
@@ -80,7 +127,8 @@ linters:
80127
- gocritic
81128
- gocyclo
82129
- godot
83-
- godox
130+
- gofmt
131+
- gofumpt
84132
- goprintffuncname
85133
- gosec
86134
- gosimple
@@ -90,13 +138,17 @@ linters:
90138
- nakedret
91139
- nestif
92140
- nilerr
141+
- noctx
93142
- prealloc
143+
- predeclared
144+
- promlinter
94145
- revive
95146
- rowserrcheck
96147
- sqlclosecheck
97148
- staticcheck
98149
- structcheck
99150
- stylecheck
151+
- tenv
100152
- tparallel
101153
- typecheck
102154
- unconvert
@@ -105,10 +157,3 @@ linters:
105157
- varcheck
106158
- wastedassign
107159
- whitespace
108-
109-
# golangci.com configuration
110-
# https://github.com/golangci/golangci/wiki/Configuration
111-
service:
112-
golangci-lint-version: 1.44.x
113-
prepare:
114-
- echo "here I can run custom commands, but no preparation needed for this repo"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ ci_tests: ## Run tests for CI.
2929

3030
.PHONY: dependencies
3131
dependencies: ## Install dependencies requried for development operations.
32-
@go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2
3332
@go install github.com/cespare/reflex@latest
3433
@go get github.com/stretchr/testify/mock
3534
@go get github.com/vektra/mockery/.../
35+
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.0
3636
@go mod tidy
3737

3838
.PHONY: clean

contract.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Package dbtools contains logic for database transaction, using the retry
2+
// library.
13
package dbtools
24

35
import (

dbtesting/dbtesting.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package dbtesting provides handy tools for using with databases.
12
package dbtesting
23

34
import (

0 commit comments

Comments
 (0)