Skip to content

Commit 52507d8

Browse files
authored
Merge pull request #33 from crazy-max/update-golangci-lint
update golangci-lint to v2.1.6
2 parents ad283ae + d57358a commit 52507d8

File tree

7 files changed

+76
-68
lines changed

7 files changed

+76
-68
lines changed

.golangci.yml

Lines changed: 65 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
run:
2-
timeout: 10m
3-
# default uses Go version from the go.mod file, fallback on the env var
4-
# `GOVERSION`, fallback on 1.17: https://golangci-lint.run/usage/configuration/#run-configuration
5-
go: "1.23"
1+
version: "2"
62

73
linters:
84
enable:
95
- bodyclose
106
- depguard
117
- forbidigo
128
- gocritic
13-
- gofmt
14-
- goimports
159
- gosec
16-
- gosimple
1710
- govet
1811
- ineffassign
1912
- makezero
@@ -23,60 +16,74 @@ linters:
2316
- revive
2417
- staticcheck
2518
- testifylint
26-
- typecheck
2719
- unused
2820
- whitespace
29-
disable-all: true
30-
31-
linters-settings:
32-
gocritic:
33-
disabled-checks:
34-
- "ifElseChain"
35-
- "assignOp"
36-
- "appendAssign"
37-
- "singleCaseSwitch"
38-
govet:
39-
enable:
40-
- nilness
41-
- unusedwrite
42-
depguard:
21+
settings:
22+
gocritic:
23+
disabled-checks:
24+
- "ifElseChain"
25+
- "assignOp"
26+
- "appendAssign"
27+
- "singleCaseSwitch"
28+
govet:
29+
enable:
30+
- nilness
31+
- unusedwrite
32+
depguard:
33+
rules:
34+
main:
35+
deny:
36+
- pkg: "io/ioutil"
37+
desc: The io/ioutil package has been deprecated.
38+
gosec:
39+
config:
40+
G306: "0644"
41+
testifylint:
42+
disable:
43+
- "empty"
44+
- "bool-compare"
45+
- "len"
46+
- "negative-positive"
47+
exclusions:
48+
generated: lax
49+
presets:
50+
- comments
51+
- common-false-positives
52+
- legacy
53+
- std-error-handling
4354
rules:
44-
main:
45-
deny:
46-
- pkg: "io/ioutil"
47-
desc: The io/ioutil package has been deprecated.
48-
gosec:
49-
config:
50-
G306: "0644"
51-
testifylint:
52-
disable:
53-
# disable rules that reduce the test condition
54-
- "empty"
55-
- "bool-compare"
56-
- "len"
57-
- "negative-positive"
55+
-
56+
linters:
57+
- revive
58+
text: stutters
59+
-
60+
linters:
61+
- revive
62+
text: empty-block
63+
-
64+
linters:
65+
- revive
66+
text: superfluous-else
67+
-
68+
linters:
69+
- revive
70+
text: unused-parameter
71+
-
72+
linters:
73+
- revive
74+
text: redefines-builtin-id
75+
-
76+
linters:
77+
- revive
78+
text: if-return
5879

59-
issues:
60-
exclude-rules:
61-
- linters:
62-
- revive
63-
text: "stutters"
64-
- linters:
65-
- revive
66-
text: "empty-block"
67-
- linters:
68-
- revive
69-
text: "superfluous-else"
70-
- linters:
71-
- revive
72-
text: "unused-parameter"
73-
- linters:
74-
- revive
75-
text: "redefines-builtin-id"
76-
- linters:
77-
- revive
78-
text: "if-return"
80+
formatters:
81+
enable:
82+
- gofmt
83+
- goimports
84+
exclusions:
85+
generated: lax
7986

80-
# show all
87+
issues:
8188
max-issues-per-linter: 0
8289
max-same-issues: 0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# syntax=docker/dockerfile:1
22

33
ARG GO_VERSION="1.23"
4-
ARG GOLANGCI_LINT_VERSION="v1.62"
4+
ARG GOLANGCI_LINT_VERSION="v2.1.6"
55

66
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
77

codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ comment: false
33
coverage:
44
status:
55
patch: false
6+
project: false
67

78
github_checks:
89
annotations: false

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/crazy-max/gohealthchecks
22

3-
go 1.13
3+
go 1.21.0

healthchecks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func NewClient(o *ClientOptions) *Client {
5454

5555
c.Timeout = 10 * time.Second
5656
c.Transport = roundTripperFunc(func(r *http.Request) (resp *http.Response, err error) {
57-
r.Header.Set("User-Agent", fmt.Sprintf("gohealthchecks/%s go/%s %s", version, runtime.Version()[2:], strings.Title(runtime.GOOS)))
57+
r.Header.Set("User-Agent", fmt.Sprintf("gohealthchecks/%s go/%s %s", version, runtime.Version()[2:], strings.Title(runtime.GOOS))) //nolint:staticcheck // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
5858
u, err := baseURL.Parse(r.URL.String())
5959
if err != nil {
6060
return nil, err

healthchecks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestClient(t *testing.T) {
1818
defer teardown()
1919

2020
mux.HandleFunc(fmt.Sprintf("/%s", uuid), func(w http.ResponseWriter, r *http.Request) {
21-
w.Write([]byte(`OK`))
21+
_, _ = w.Write([]byte(`OK`))
2222
})
2323

2424
if err := client.Success(context.Background(), gohealthchecks.PingingOptions{

pinging_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestSuccess(t *testing.T) {
1818
defer teardown()
1919

2020
mux.HandleFunc(fmt.Sprintf("/%s", uuid), func(w http.ResponseWriter, r *http.Request) {
21-
w.Write([]byte(`OK`))
21+
_, _ = w.Write([]byte(`OK`))
2222
})
2323

2424
if err := client.Success(context.Background(), gohealthchecks.PingingOptions{
@@ -39,7 +39,7 @@ func TestSuccessLogs(t *testing.T) {
3939
t.Fatal(err)
4040
}
4141
assertEqual(t, "body", string(b), logs)
42-
w.Write([]byte(`OK`))
42+
_, _ = w.Write([]byte(`OK`))
4343
})
4444

4545
if err := client.Success(context.Background(), gohealthchecks.PingingOptions{
@@ -55,7 +55,7 @@ func TestFail(t *testing.T) {
5555
defer teardown()
5656

5757
mux.HandleFunc(fmt.Sprintf("/%s/fail", uuid), func(w http.ResponseWriter, r *http.Request) {
58-
w.Write([]byte(`OK`))
58+
_, _ = w.Write([]byte(`OK`))
5959
})
6060

6161
if err := client.Fail(context.Background(), gohealthchecks.PingingOptions{
@@ -76,7 +76,7 @@ func TestFailLogs(t *testing.T) {
7676
t.Fatal(err)
7777
}
7878
assertEqual(t, "body", string(b), logs)
79-
w.Write([]byte(`OK`))
79+
_, _ = w.Write([]byte(`OK`))
8080
})
8181

8282
if err := client.Fail(context.Background(), gohealthchecks.PingingOptions{
@@ -92,7 +92,7 @@ func TestStart(t *testing.T) {
9292
defer teardown()
9393

9494
mux.HandleFunc(fmt.Sprintf("/%s/start", uuid), func(w http.ResponseWriter, r *http.Request) {
95-
w.Write([]byte(`OK`))
95+
_, _ = w.Write([]byte(`OK`))
9696
})
9797

9898
if err := client.Start(context.Background(), gohealthchecks.PingingOptions{
@@ -113,7 +113,7 @@ func TestStartLogs(t *testing.T) {
113113
t.Fatal(err)
114114
}
115115
assertEqual(t, "body", string(b), logs)
116-
w.Write([]byte(`OK`))
116+
_, _ = w.Write([]byte(`OK`))
117117
})
118118

119119
if err := client.Start(context.Background(), gohealthchecks.PingingOptions{

0 commit comments

Comments
 (0)