Skip to content

Commit 7c56215

Browse files
Fix linter problems
1 parent 5df5466 commit 7c56215

File tree

15 files changed

+94
-79
lines changed

15 files changed

+94
-79
lines changed

.golangci.yaml

Lines changed: 62 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,74 @@
1-
issues:
2-
exclude-rules:
3-
# Test functions tend to be quite long due to the large amount of fixtures & test data etc.
4-
- linters:
5-
- funlen
6-
path: _test\.go
7-
text: "is too long"
8-
# There's no need to wrap errors in a test.
9-
- linters:
10-
- wrapcheck
11-
path: _test\.go
12-
text: "error returned from external package is unwrapped"
13-
# Commonly used in tests, and using sentinel errors for this is overkill.
14-
- linters:
15-
- nilnil
16-
path: _test\.go
17-
text: " use a sentinel error instead"
18-
1+
version: "2"
192
linters:
20-
enable-all: true
3+
default: all
214
disable:
22-
# tmpfix - currently breaking things
23-
- musttag
24-
255
- depguard
266
- exhaustruct
277
- forcetypeassert
288
- godox
299
- gomoddirectives
3010
- gomodguard
3111
- ireturn
32-
33-
# deprecated
34-
- testableexamples
35-
36-
# disabled because of generics
12+
- musttag
3713
- rowserrcheck
14+
- testableexamples
3815
- wastedassign
39-
40-
linters-settings:
41-
gomoddirectives:
42-
replace-local: true
43-
44-
gci:
45-
sections:
46-
- standard
47-
- default
48-
- prefix(github.com/ovotech)
49-
- blank
50-
- dot
51-
skip-generated: true
52-
custom-order: true
53-
54-
revive:
55-
confidence: 0.1
56-
severity: warning
16+
settings:
17+
gomoddirectives:
18+
replace-local: true
19+
revive:
20+
confidence: 0.1
21+
severity: warning
22+
rules:
23+
- name: exported
24+
arguments:
25+
- checkPrivateReceivers
26+
severity: error
27+
disabled: false
28+
funcorder:
29+
struct-method: false
30+
exclusions:
31+
generated: lax
32+
presets:
33+
- comments
34+
- common-false-positives
35+
- legacy
36+
- std-error-handling
5737
rules:
58-
- name: exported
59-
severity: error
60-
disabled: false
61-
arguments:
62-
- checkPrivateReceivers
63-
64-
run:
65-
timeout: "5m"
38+
- linters:
39+
- funlen
40+
path: _test\.go
41+
text: is too long
42+
- linters:
43+
- wrapcheck
44+
path: _test\.go
45+
text: error returned from external package is unwrapped
46+
- linters:
47+
- nilnil
48+
path: _test\.go
49+
text: ' use a sentinel error instead'
50+
paths:
51+
- third_party$
52+
- builtin$
53+
- examples$
54+
formatters:
55+
enable:
56+
- gci
57+
- gofmt
58+
- gofumpt
59+
- goimports
60+
settings:
61+
gci:
62+
sections:
63+
- standard
64+
- default
65+
- prefix(github.com/ovotech)
66+
- blank
67+
- dot
68+
custom-order: true
69+
exclusions:
70+
generated: lax
71+
paths:
72+
- third_party$
73+
- builtin$
74+
- examples$

adapters/azuread/groupmembership/groupmembership_internal_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,9 @@ func (r *MockRequestAdapter) GetSerializationWriterFactory() serialization.Seria
464464
func (r *MockRequestAdapter) EnableBackingStore(_ store.BackingStoreFactory) {
465465
}
466466

467-
//nolint:stylecheck
468467
func (r *MockRequestAdapter) SetBaseUrl(_ string) {
469468
}
470469

471-
//nolint:stylecheck
472470
func (r *MockRequestAdapter) GetBaseUrl() string {
473471
return ""
474472
}

adapters/azuread/user/user_internal_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,9 @@ func (r *MockRequestAdapter) GetSerializationWriterFactory() serialization.Seria
9696
func (r *MockRequestAdapter) EnableBackingStore(_ store.BackingStoreFactory) {
9797
}
9898

99-
//nolint:stylecheck
10099
func (r *MockRequestAdapter) SetBaseUrl(_ string) {
101100
}
102101

103-
//nolint:stylecheck
104102
func (r *MockRequestAdapter) GetBaseUrl() string {
105103
return ""
106104
}
@@ -234,7 +232,7 @@ func TestInit(t *testing.T) {
234232
adapter, err := Init(ctx, map[gosync.ConfigKey]string{})
235233

236234
require.NoError(t, err)
237-
assert.Equal(t, "", adapter.filter)
235+
assert.Empty(t, adapter.filter)
238236
})
239237
})
240238
}

adapters/google/group/group.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ var (
6565

6666
// callList allows us to mock the returned struct from the List Google API call.
6767
func callList(ctx context.Context, call *admin.MembersListCall, pageToken string) (*admin.Members, error) {
68-
return call.Context(ctx).PageToken(pageToken).MaxResults(200).Do() //nolint:wrapcheck,gomnd,mnd
68+
return call.Context(ctx).PageToken(pageToken).MaxResults(200).Do() //nolint:wrapcheck,mnd
6969
}
7070

7171
// callInsert allows us to mock the returned struct from the Insert Google API call.

adapters/google/group/group_internal_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ func TestInit(t *testing.T) {
217217
require.NoError(t, err)
218218
assert.IsType(t, &Group{}, adapter)
219219
assert.Equal(t, "name", adapter.name)
220-
assert.Equal(t, "", adapter.DeliverySettings)
221-
assert.Equal(t, "", adapter.Role)
220+
assert.Empty(t, adapter.DeliverySettings)
221+
assert.Empty(t, adapter.Role)
222222
})
223223

224224
t.Run("missing config", func(t *testing.T) {

adapters/opsgenie/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ require (
66
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23
77
github.com/ovotech/go-sync v0.14.0
88
github.com/stretchr/testify v1.10.0
9-
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476
109
)
1110

1211
require (

adapters/opsgenie/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
6161
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
6262
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
6363
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
64-
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4=
65-
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
6664
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
6765
golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ=
6866
golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM=

adapters/opsgenie/schedule/schedule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import (
2525
"fmt"
2626
"log"
2727
"os"
28+
"slices"
2829

2930
"github.com/opsgenie/opsgenie-go-sdk-v2/client"
3031
"github.com/opsgenie/opsgenie-go-sdk-v2/og"
3132
ogSchedule "github.com/opsgenie/opsgenie-go-sdk-v2/schedule"
32-
"golang.org/x/exp/slices"
3333

3434
gosync "github.com/ovotech/go-sync"
3535
)

adapters/opsgenie/schedule/schedule_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func testBuildScheduleGetResult(numRotations int, emails ...string) *schedule.Ge
8484
StartDate: nil,
8585
EndDate: nil,
8686
Type: og.Weekly,
87-
Length: uint32(len(participants)),
87+
Length: uint32(len(participants)), //nolint:gosec
8888
Participants: participants,
8989
TimeRestriction: nil,
9090
}

adapters/slack/conversation/conversation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (c *Conversation) getListOfSlackUsernames() ([]string, error) {
9494
params := &slack.GetUsersInConversationParameters{
9595
ChannelID: c.conversationName,
9696
Cursor: cursor,
97-
Limit: 50, //nolint:gomnd,mnd
97+
Limit: 50, //nolint:mnd
9898
}
9999

100100
var pageOfUsers []string

0 commit comments

Comments
 (0)