Skip to content

Commit b7ea1ca

Browse files
authored
Merge pull request #616 from innogames/go122
linter update
2 parents d60fdda + 3898a58 commit b7ea1ca

23 files changed

Lines changed: 54 additions & 48 deletions

File tree

.golangci.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
21
issues:
32
exclude-rules:
43
- path: _test\.go
54
linters:
65
- errcheck
6+
- perfsprint
7+
- usestdlibvars
8+
79

810
linters:
911
enable:
@@ -14,12 +16,14 @@ linters:
1416
- dogsled
1517
- dupl
1618
- errcheck
19+
- errname
1720
- errorlint
1821
- exhaustive
1922
- exportloopref
2023
- fatcontext
21-
- gochecknoinits
24+
- gci
2225
- gocheckcompilerdirectives
26+
- gochecknoinits
2327
- gocritic
2428
- gocyclo
2529
- gofumpt
@@ -31,12 +35,14 @@ linters:
3135
- ineffassign
3236
- intrange
3337
- loggercheck
34-
- mirror
3538
- makezero
36-
- misspell
3739
- mirror
40+
- misspell
41+
- musttag
3842
- nakedret
43+
- nilerr
3944
- nolintlint
45+
- noctx
4046
- perfsprint
4147
- prealloc
4248
- predeclared
@@ -45,12 +51,26 @@ linters:
4551
- staticcheck
4652
- stylecheck
4753
- tagalign
54+
- tenv
4855
- testifylint
4956
- thelper
5057
- typecheck
5158
- unconvert
5259
- unparam
5360
- unused
61+
- usestdlibvars
5462
- wastedassign
5563
- whitespace
5664
fast: false
65+
66+
govet:
67+
enable-all: true
68+
disable:
69+
- structtag
70+
71+
gofumpt:
72+
extra-rules: true
73+
74+
perfsprint:
75+
errorf: false
76+
strconcat: false

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dep:
3131
@go mod vendor
3232

3333
lint:
34-
golangci-lint run
34+
golangci-lint run --fix
3535

3636
docker-build:
3737
docker build . --force-rm -t brainexe/slack-bot:latest

bot/app/start.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/innogames/slack-bot/v2/bot/util"
1212
"github.com/innogames/slack-bot/v2/client"
1313
"github.com/innogames/slack-bot/v2/command"
14-
1514
log "github.com/sirupsen/logrus"
1615
)
1716

bot/config/config_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package config
22

33
import (
4-
"os"
54
"path"
65
"testing"
76

@@ -70,10 +69,10 @@ func TestLoadFile(t *testing.T) {
7069
}
7170

7271
func TestEnvironment(t *testing.T) {
73-
os.Setenv("BOT_TIMEZONE", "Europe/Berlin")
74-
os.Setenv("BOT_SLACK_TOKEN", "mySlackToken")
75-
os.Setenv("BOT_SLACK_SOCKET_TOKEN", "mySlackSocketToken")
76-
os.Setenv("BOT_GITHUB_ACCESS_TOKEN", "myGithubToken")
72+
t.Setenv("BOT_TIMEZONE", "Europe/Berlin")
73+
t.Setenv("BOT_SLACK_TOKEN", "mySlackToken")
74+
t.Setenv("BOT_SLACK_SOCKET_TOKEN", "mySlackSocketToken")
75+
t.Setenv("BOT_GITHUB_ACCESS_TOKEN", "myGithubToken")
7776

7877
// load example file == okay
7978
cfg, err := Load("../../config.example.yaml")

bot/matcher/options.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import (
66
"slices"
77
"strings"
88

9-
"github.com/innogames/slack-bot/v2/client"
10-
119
"github.com/innogames/slack-bot/v2/bot/msg"
10+
"github.com/innogames/slack-bot/v2/client"
1211
)
1312

1413
func NewOptionMatcher(baseCommand string, whiteList []string, run Runner, slackClient client.SlackClient) Matcher {

bot/stats/metrics_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/innogames/slack-bot/v2/bot/config"
1111
"github.com/innogames/slack-bot/v2/bot/util"
12-
1312
"github.com/stretchr/testify/assert"
1413
)
1514

bot/tester/formatter_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"testing"
55

66
"github.com/gookit/color"
7-
87
"github.com/stretchr/testify/assert"
98
)
109

command/admin/stats.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package admin
22

33
import (
44
"fmt"
5+
"math"
56
"runtime"
67
"strings"
78
"time"
@@ -97,6 +98,10 @@ func formatStats(key string) string {
9798
return "0"
9899
}
99100

101+
if value > uint(math.MaxInt) {
102+
return fmt.Sprintf("overflow: %d", value)
103+
}
104+
100105
return util.FormatInt(int(value))
101106
}
102107

command/custom_commmands/integration_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ package custom_commmands
33
import (
44
"testing"
55

6-
"github.com/innogames/slack-bot/v2/bot/config"
7-
86
"github.com/innogames/slack-bot/v2/bot"
7+
"github.com/innogames/slack-bot/v2/bot/config"
98
"github.com/innogames/slack-bot/v2/bot/msg"
109
"github.com/innogames/slack-bot/v2/mocks"
1110
"github.com/stretchr/testify/assert"

command/custom_variables/integration_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ package custom_variables
33
import (
44
"testing"
55

6-
"github.com/innogames/slack-bot/v2/bot/config"
7-
86
"github.com/innogames/slack-bot/v2/bot"
7+
"github.com/innogames/slack-bot/v2/bot/config"
98
"github.com/innogames/slack-bot/v2/bot/msg"
109
"github.com/innogames/slack-bot/v2/mocks"
1110
"github.com/stretchr/testify/assert"

0 commit comments

Comments
 (0)