Skip to content

Commit 2d6e456

Browse files
committed
chore: update linter
1 parent 44e6ebe commit 2d6e456

File tree

5 files changed

+104
-109
lines changed

5 files changed

+104
-109
lines changed

.github/workflows/go-cross.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
name: Go Matrix
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
310

411
jobs:
512

.github/workflows/main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ name: Main
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
tags:
88
- v*
99
pull_request:
10+
branches:
11+
- main
1012

1113
jobs:
1214

@@ -15,7 +17,7 @@ jobs:
1517
runs-on: ubuntu-latest
1618
env:
1719
GO_VERSION: stable
18-
GOLANGCI_LINT_VERSION: v1.56.0
20+
GOLANGCI_LINT_VERSION: v2.0.2
1921
CGO_ENABLED: 0
2022

2123
steps:
@@ -41,7 +43,7 @@ jobs:
4143
4244
# https://golangci-lint.run/usage/install#other-ci
4345
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
44-
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
46+
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
4547

4648
- name: Make
4749
run: make

.golangci.yml

Lines changed: 87 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,102 @@
1-
run:
2-
timeout: 5m
3-
show-stats: true
4-
skip-files: [ ]
5-
skip-dirs: [ ]
1+
version: "2"
62

7-
linters-settings:
8-
govet:
9-
enable-all: true
10-
disable:
11-
- fieldalignment
12-
gosec:
13-
excludes:
14-
- G306
15-
gocyclo:
16-
min-complexity: 15
17-
maligned:
18-
suggest-new: true
19-
goconst:
20-
min-len: 5
21-
min-occurrences: 3
22-
misspell:
23-
locale: US
24-
funlen:
25-
lines: -1
26-
statements: 40
27-
godox:
28-
keywords:
29-
- FIXME
30-
gofumpt:
31-
extra-rules: true
32-
depguard:
33-
rules:
34-
main:
35-
deny:
36-
- pkg: "github.com/instana/testify"
37-
desc: not allowed
38-
- pkg: "github.com/pkg/errors"
39-
desc: Should be replaced by standard lib errors package
40-
gocritic:
41-
enabled-tags:
42-
- diagnostic
43-
- style
44-
- performance
45-
disabled-checks:
46-
- sloppyReassign
47-
- unnamedResult
48-
- rangeValCopy
49-
- octalLiteral
50-
- paramTypeCombine # already handle by gofumpt.extra-rules
51-
settings:
52-
hugeParam:
53-
sizeThreshold: 100
3+
formatters:
4+
enable:
5+
- gci
6+
- gofumpt
7+
settings:
8+
gofumpt:
9+
extra-rules: true
5410

5511
linters:
56-
enable-all: true
12+
default: all
5713
disable:
58-
- deadcode # deprecated
59-
- exhaustivestruct # deprecated
60-
- golint # deprecated
61-
- ifshort # deprecated
62-
- interfacer # deprecated
63-
- maligned # deprecated
64-
- nosnakecase # deprecated
65-
- scopelint # deprecated
66-
- structcheck # deprecated
67-
- varcheck # deprecated
68-
- sqlclosecheck # not relevant (SQL)
69-
- rowserrcheck # not relevant (SQL)
70-
- execinquery # not relevant (SQL)
7114
- cyclop # duplicate of gocyclo
72-
- lll
7315
- dupl
74-
- wsl
75-
- nlreturn
76-
- gomnd
77-
- goerr113
78-
- wrapcheck
16+
- err113
7917
- exhaustive
8018
- exhaustruct
81-
- testpackage
82-
- tparallel
83-
- paralleltest
84-
- prealloc
85-
- ifshort
8619
- forcetypeassert
20+
- lll
21+
- mnd
22+
- nlreturn
8723
- noctx
24+
- paralleltest
25+
- prealloc
26+
- rowserrcheck # not relevant (SQL)
27+
- sqlclosecheck # not relevant (SQL)
28+
- testpackage
29+
- tparallel
8830
- varnamelen
31+
- wrapcheck
32+
- wsl
33+
34+
settings:
35+
depguard:
36+
rules:
37+
main:
38+
deny:
39+
- pkg: github.com/instana/testify
40+
desc: not allowed
41+
- pkg: github.com/pkg/errors
42+
desc: Should be replaced by standard lib errors package
43+
funlen:
44+
lines: -1
45+
statements: 40
46+
goconst:
47+
min-len: 5
48+
min-occurrences: 3
49+
gocritic:
50+
disabled-checks:
51+
- sloppyReassign
52+
- unnamedResult
53+
- rangeValCopy
54+
- octalLiteral
55+
- paramTypeCombine # already handle by gofumpt.extra-rules
56+
enabled-tags:
57+
- diagnostic
58+
- style
59+
- performance
60+
settings:
61+
hugeParam:
62+
sizeThreshold: 100
63+
gocyclo:
64+
min-complexity: 15
65+
godox:
66+
keywords:
67+
- FIXME
68+
gosec:
69+
excludes:
70+
- G306
71+
govet:
72+
disable:
73+
- fieldalignment
74+
enable-all: true
75+
misspell:
76+
locale: US
77+
perfsprint:
78+
err-error: true
79+
errorf: true
80+
sprintf1: true
81+
strconcat: false
82+
83+
exclusions:
84+
warn-unused: true
85+
presets:
86+
- comments
87+
rules:
88+
- linters:
89+
- funlen
90+
path: .*_test.go
91+
- path: model.go
92+
text: type Dns(.+) should be DNS(.+)
93+
- path: params.go
94+
text: type Dns(.+) should be DNS(.+)
95+
- path: zz_gen_client.go
96+
text: method Dns(.+) should be DNS(.+)
97+
- path: zz_gen_client_test.go
98+
text: setupFakeAPI - result 0 \(\*net/http\.ServeMux\) is never used
8999

90100
issues:
91-
exclude-use-default: false
92101
max-issues-per-linter: 0
93102
max-same-issues: 0
94-
exclude:
95-
- 'fmt.Sprintf can be replaced with string addition'
96-
exclude-rules:
97-
- path: .*_test.go
98-
linters:
99-
- funlen
100-
- path: model.go
101-
text: type Dns(.+) should be DNS(.+)
102-
- path: params.go
103-
text: type Dns(.+) should be DNS(.+)
104-
- path: zz_gen_client.go
105-
text: method Dns(.+) should be DNS(.+)
106-
- path: zz_gen_client_test.go
107-
text: 'string `1234` has 56 occurrences, make it a constant'
108-
- path: zz_gen_client_test.go
109-
text: setupFakeAPI - result 0 \(\*net/http\.ServeMux\) is never used
110-
- path: gen/gen_test.go
111-
text: func `generate` is unused
112-
- path: gen/gen_test.go
113-
text: type `BaseName` is unused
114-
- path: .*/encoding/xml/.* # Disabled to a bug in musttag
115-
linters:
116-
- musttag

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/nrdcg/namesilo
22

3-
go 1.19
3+
go 1.22
44

55
require (
66
github.com/google/go-querystring v1.1.0
7-
github.com/stretchr/testify v1.8.4
7+
github.com/stretchr/testify v1.10.0
88
)
99

1010
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD
66
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
77
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
88
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
9-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
10-
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
9+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
10+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
1111
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1212
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1313
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

0 commit comments

Comments
 (0)