Skip to content

Commit 2e6b85c

Browse files
authored
chore: upgrade Go and golangci-lint (#70)
* chore: upgrade go to v1.24.1 * chore: upgrade linter
1 parent 3bbc203 commit 2e6b85c

6 files changed

Lines changed: 57 additions & 26 deletions

File tree

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Go
1515
uses: actions/setup-go@v5
1616
with:
17-
go-version: '1.23.2'
17+
go-version: '1.24.1'
1818
id: go
1919

2020
- name: Check out code into the Go module directory

.golangci.json

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,58 @@
11
{
2+
"formatters": {
3+
"enable": [
4+
"gci",
5+
"gofmt",
6+
"gofumpt",
7+
"goimports"
8+
],
9+
"exclusions": {
10+
"generated": "lax",
11+
"paths": [
12+
"third_party$",
13+
"builtin$",
14+
"examples$"
15+
]
16+
},
17+
"settings": {
18+
"goimports": {
19+
"local-prefixes": [
20+
"github.com/hedhyw/rex/"
21+
]
22+
}
23+
}
24+
},
225
"linters": {
3-
"enable-all": true,
26+
"default": "all",
427
"disable": [
5-
"nonamedreturns",
6-
"wrapcheck",
7-
"varnamelen",
8-
"thelper",
9-
"paralleltest",
10-
"ireturn",
11-
"gomnd",
12-
"nolintlint",
28+
"copyloopvar",
1329
"depguard",
1430
"goconst",
15-
"exportloopref",
16-
"mnd",
17-
"copyloopvar",
18-
"execinquery",
1931
"govet",
20-
"intrange"
21-
]
32+
"intrange",
33+
"ireturn",
34+
"mnd",
35+
"nolintlint",
36+
"nonamedreturns",
37+
"paralleltest",
38+
"thelper",
39+
"varnamelen",
40+
"wrapcheck"
41+
],
42+
"exclusions": {
43+
"generated": "lax",
44+
"paths": [
45+
"third_party$",
46+
"builtin$",
47+
"examples$"
48+
],
49+
"presets": [
50+
"comments",
51+
"common-false-positives",
52+
"legacy",
53+
"std-error-handling"
54+
]
55+
}
2256
},
23-
"linters-settings": {
24-
"goimports": {
25-
"local-prefixes": "github.com/hedhyw/rex/"
26-
},
27-
"revive": {}
28-
}
29-
}
57+
"version": "2"
58+
}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GOLANG_CI_LINT_VER:=v1.61.0
1+
GOLANG_CI_LINT_VER:=v2.0.2
22
COVER_PACKAGES=${shell go list ./... | grep -Ev 'test|cmd' | tr '\n' ','}
33

44
all: lint test

internal/helper/helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// nolint: goerr113 // Test error.
21
package helper_test
32

43
import (
@@ -117,6 +116,7 @@ func TestProcessTokensFailed(t *testing.T) {
117116

118117
_, err := helper.ProcessTokens(sb, []dialect.Token{
119118
helper.TokenFunc(func(dialect.StringByteWriter) (int, error) {
119+
// nolint: err113 // Test.
120120
return 0, errors.New("failed")
121121
}),
122122
})

pkg/dialect/base/chars_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ func TestRexChars_runes(t *testing.T) {
175175
}, {
176176
Name: "unicode",
177177
Chain: []dialect.Token{
178+
// nolint: gosmopolitan // A test.
178179
base.Chars.Runes("ひヒ家"),
179180
},
180181
Expected: `[\x{3072}\x{30D2}\x{5BB6}]`,

pkg/rex/examples_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// nolint: lll,nosnakecase // Generated regular expression can be long.
1+
// nolint: lll // Generated regular expression can be long.
22
package rex_test
33

44
import (
@@ -183,6 +183,7 @@ func Example_unicodeByName() {
183183

184184
fmt.Println("Hiragana: ひ", re.MatchString("ひ"))
185185
fmt.Println("Katakana: ヒ", re.MatchString("ひ"))
186+
// nolint: gosmopolitan // A test.
186187
fmt.Println("Kanji: 家", re.MatchString("家"))
187188
fmt.Println("Other: a", re.MatchString("a"))
188189
// Output:

0 commit comments

Comments
 (0)