Skip to content

Commit 2bc3536

Browse files
authored
Go 1.24 and golangci-lint v2.0 (nicksnyder#369)
1 parent fd1f64e commit 2bc3536

File tree

10 files changed

+30
-15
lines changed

10 files changed

+30
-15
lines changed

‎.github/workflows/build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Install Go
1414
uses: actions/setup-go@v5
1515
with:
16-
go-version: stable
16+
go-version: '1.24'
1717
- name: Git checkout
1818
uses: actions/checkout@v4
1919
- name: Build

‎.github/workflows/golangci-lint.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- uses: actions/setup-go@v5
1818
with:
19-
go-version: stable
19+
go-version: '1.24'
2020
- name: golangci-lint
21-
uses: golangci/golangci-lint-action@v6
21+
uses: golangci/golangci-lint-action@v7
2222
with:
23-
version: v1.61
23+
version: v2.0

‎.github/workflows/goreleaser.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: Set up Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: stable
21+
go-version: '1.24'
2222
-
2323
name: Release
2424
uses: goreleaser/goreleaser-action@v6

‎.golangci.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: "2"
2+
linters:
3+
exclusions:
4+
rules:
5+
- path: rule_gen\.go
6+
text: "QF1001:"

‎goi18n/common_test.go‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package main
22

3-
import "os"
3+
import (
4+
"os"
5+
"testing"
6+
)
47

58
func mustTempDir(prefix string) string {
69
outdir, err := os.MkdirTemp("", prefix)
@@ -9,3 +12,9 @@ func mustTempDir(prefix string) string {
912
}
1013
return outdir
1114
}
15+
16+
func mustRemoveAll(t *testing.T, path string) {
17+
if err := os.RemoveAll(path); err != nil {
18+
t.Fatal(err)
19+
}
20+
}

‎goi18n/extract_command_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ zero = "Zero translation"
290290
for _, test := range tests {
291291
t.Run(test.name, func(t *testing.T) {
292292
indir := mustTempDir("TestExtractCommandIn")
293-
defer os.RemoveAll(indir)
293+
defer mustRemoveAll(t, indir)
294294
outdir := mustTempDir("TestExtractCommandOut")
295-
defer os.RemoveAll(outdir)
295+
defer mustRemoveAll(t, outdir)
296296

297297
inpath := filepath.Join(indir, test.fileName)
298298
if err := os.WriteFile(inpath, []byte(test.file), 0666); err != nil {
@@ -342,7 +342,7 @@ func TestExtractCommand(t *testing.T) {
342342
if err != nil {
343343
t.Fatal(err)
344344
}
345-
defer os.RemoveAll(outdir)
345+
defer mustRemoveAll(t, outdir)
346346
if code := testableMain([]string{"extract", "-outdir", outdir, "../example/"}); code != 0 {
347347
t.Fatalf("expected exit code 0; got %d", code)
348348
}

‎goi18n/merge_command.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (mc *mergeCommand) execute() error {
9999
}
100100
for _, path := range ops.deleteFiles {
101101
// Ignore error since it isn't guaranteed to exist.
102-
os.Remove(path)
102+
_ = os.Remove(path)
103103
}
104104
return nil
105105
}

‎goi18n/merge_command_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,9 @@ zero = "{{.Count}} unread emails"
530530
for _, testCase := range testCases {
531531
t.Run(testCase.name, func(t *testing.T) {
532532
indir := mustTempDir("TestMergeCommandIn")
533-
defer os.RemoveAll(indir)
533+
defer mustRemoveAll(t, indir)
534534
outdir := mustTempDir("TestMergeCommandOut")
535-
defer os.RemoveAll(outdir)
535+
defer mustRemoveAll(t, outdir)
536536

537537
infiles := make([]string, 0, len(testCase.inFiles))
538538
for name, content := range testCase.inFiles {

‎i18n/message_template.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (mt *MessageTemplate) Execute(pluralForm plural.Form, data interface{}, fun
6161
if t == nil {
6262
return "", pluralFormNotFoundError{
6363
pluralForm: pluralForm,
64-
messageID: mt.Message.ID,
64+
messageID: mt.ID,
6565
}
6666
}
6767
parser := &template.TextParser{
@@ -75,7 +75,7 @@ func (mt *MessageTemplate) execute(pluralForm plural.Form, data interface{}, par
7575
if t == nil {
7676
return "", pluralFormNotFoundError{
7777
pluralForm: pluralForm,
78-
messageID: mt.Message.ID,
78+
messageID: mt.ID,
7979
}
8080
}
8181
return t.Execute(parser, data)

‎internal/plural/codegen/xml.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type PluralGroup struct {
2626
// Name returns a unique name for this plural group.
2727
func (pg *PluralGroup) Name() string {
2828
n := cases.Title(language.AmericanEnglish).String(pg.Locales)
29-
return strings.Replace(n, " ", "", -1)
29+
return strings.ReplaceAll(n, " ", "")
3030
}
3131

3232
// SplitLocales returns all the locales in the PluralGroup as a slice.

0 commit comments

Comments
 (0)