Skip to content

Commit 77ee70b

Browse files
wiggin77claude
andauthored
Bump Go version to 1.24.6 and golangci-lint to v2.6.0 (#944)
* Bump Go version to 1.24.6 and golangci-lint to v2.6.0 Updates: - Update Go version from 1.23.0 to 1.24.6 - Remove toolchain directive - Update golangci-lint from v1.64.7 to v2.6.0 - Update .golangci.yml to version 2 format - Update mattermost-govet to 7d8db289e508999dfcac47b97c9490a0fec12d66 - Update CI workflow golang-version to 1.24.6 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Fix linter errors and align golangci-lint config with Jira plugin - Fix bodyclose errors in client/client_test.go - Fix misspelling in build/pluginctl/logs.go (configration -> configuration) - Align golangci-lint config with mattermost-plugin-jira - Update goconst.min-len from 2 to 3 - Remove extra exclude-rules for revive linter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
1 parent 84f95b6 commit 77ee70b

File tree

6 files changed

+85
-27
lines changed

6 files changed

+85
-27
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
uses: mattermost/actions-workflows/.github/workflows/plugin-ci.yml@main
1919
secrets: inherit
2020
with:
21-
golang-version: "1.23"
21+
golang-version: "1.24.6"

.golangci.yml

Lines changed: 75 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
version: 2
2+
13
run:
24
timeout: 5m
35
modules-download-mode: readonly
46

57
linters-settings:
68
goconst:
7-
min-len: 2
9+
min-len: 3
810
min-occurrences: 2
911
gofmt:
1012
simplify: true
@@ -16,29 +18,92 @@ linters-settings:
1618
- fieldalignment
1719
misspell:
1820
locale: US
21+
revive:
1922

2023
linters:
2124
disable-all: true
2225
enable:
2326
- bodyclose
24-
# - errcheck
25-
# - goconst
27+
- errcheck
2628
- gocritic
27-
- gofmt
28-
- goimports
29-
# - gosec
30-
- gosimple
29+
- gosec
3130
- govet
3231
- ineffassign
33-
# - misspell
32+
- misspell
3433
- nakedret
3534
- revive
3635
- staticcheck
37-
- stylecheck
38-
- typecheck
3936
- unconvert
4037
- unused
4138
- whitespace
39+
exclusions:
40+
rules:
41+
- linters:
42+
- revive
43+
text: var-naming|error-naming|exported|increment-decrement|error-strings|if-return|unused-parameter|blank-imports|empty-block|package-comments
44+
- linters:
45+
- errcheck
46+
text: Error return value
47+
- linters:
48+
- staticcheck
49+
text: SA1019
50+
- linters:
51+
- staticcheck
52+
text: ST1023
53+
- linters:
54+
- staticcheck
55+
text: ST1012
56+
- linters:
57+
- staticcheck
58+
text: ST1005
59+
- linters:
60+
- staticcheck
61+
text: QF1011
62+
- linters:
63+
- staticcheck
64+
text: QF1001
65+
- linters:
66+
- staticcheck
67+
text: QF1003
68+
- linters:
69+
- staticcheck
70+
text: QF1012
71+
- linters:
72+
- staticcheck
73+
text: QT1019
74+
- linters:
75+
- staticcheck
76+
text: QF1008
77+
- linters:
78+
- staticcheck
79+
text: QF1004
80+
- linters:
81+
- staticcheck
82+
text: ST1019
83+
- linters:
84+
- staticcheck
85+
text: QF1006
86+
- linters:
87+
- staticcheck
88+
text: QF1002
89+
- linters:
90+
- staticcheck
91+
text: QF1007
92+
- linters:
93+
- gosec
94+
text: G104
95+
- linters:
96+
- gosec
97+
text: G304
98+
- linters:
99+
- gosec
100+
text: G301
101+
102+
formatters:
103+
disable-all: true
104+
enable:
105+
- gofmt
106+
- goimports
42107

43108
issues:
44109
exclude-rules:
@@ -50,15 +115,6 @@ issues:
50115
- path: server/configuration.go
51116
linters:
52117
- unused
53-
- linters:
54-
- revive
55-
text: unused-parameter
56-
- linters:
57-
- revive
58-
text: var-naming
59-
- linters:
60-
- revive
61-
text: error-strings
62118
- path: _test\.go
63119
linters:
64120
- bodyclose

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ apply:
158158
## Install go tools
159159
install-go-tools:
160160
@echo Installing go tools
161-
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.7
161+
$(GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.0
162162
$(GO) install gotest.tools/[email protected]
163-
$(GO) install github.com/mattermost/mattermost-govet/v2@3f08281c344327ac09364f196b15f9a81c7eff08
163+
$(GO) install github.com/mattermost/mattermost-govet/v2@7d8db289e508999dfcac47b97c9490a0fec12d66
164164

165165
## Runs eslint and golangci-lint
166166
.PHONY: check-style

build/pluginctl/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func checkJSONLogsSetting(ctx context.Context, client *model.Client4) error {
181181
return fmt.Errorf("failed to fetch config: %w", err)
182182
}
183183
if cfg.LogSettings.FileJson == nil || !*cfg.LogSettings.FileJson {
184-
return errors.New("JSON output for file logs are disabled. Please enable LogSettings.FileJson via the configration in Mattermost.") //nolint:revive,stylecheck
184+
return errors.New("JSON output for file logs are disabled. Please enable LogSettings.FileJson via the configuration in Mattermost.") //nolint:revive,stylecheck
185185
}
186186

187187
return nil

client/client_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ import (
2323
func TestRoundTripper(t *testing.T) {
2424
t.Run("Valid response", func(t *testing.T) {
2525
pluginAPI := &plugintest.API{}
26-
pluginAPI.On("PluginHTTP", mock.AnythingOfType("*http.Request")).Return(&http.Response{StatusCode: http.StatusOK})
26+
pluginAPI.On("PluginHTTP", mock.AnythingOfType("*http.Request")).Return(&http.Response{StatusCode: http.StatusOK, Body: http.NoBody})
2727

2828
roundTripper := pluginAPIRoundTripper{api: pluginAPI}
2929
req, err := http.NewRequest(http.MethodPost, "url", nil)
3030
require.NoError(t, err)
3131

3232
resp, err := roundTripper.RoundTrip(req)
3333
require.NoError(t, err)
34+
defer resp.Body.Close()
3435
require.Equal(t, http.StatusOK, resp.StatusCode)
3536
})
3637

@@ -44,6 +45,9 @@ func TestRoundTripper(t *testing.T) {
4445
require.NoError(t, err)
4546

4647
resp, err := roundTripper.RoundTrip(req)
48+
if resp != nil && resp.Body != nil {
49+
defer resp.Body.Close()
50+
}
4751
require.Nil(t, resp)
4852
require.Error(t, err)
4953
})

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/mattermost/mattermost-plugin-github
22

3-
go 1.23.0
4-
5-
toolchain go1.23.8
3+
go 1.24.6
64

75
require (
86
github.com/Masterminds/sprig/v3 v3.2.2

0 commit comments

Comments
 (0)