Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
go-version: '1.24'
- name: Git checkout
uses: actions/checkout@v4
- name: Build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
go-version: '1.24'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
version: v1.61
version: v2.0
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
go-version: '1.24'
-
name: Release
uses: goreleaser/goreleaser-action@v6
Expand Down
6 changes: 6 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "2"
linters:
exclusions:
rules:
- path: rule_gen\.go
text: "QF1001:"
11 changes: 10 additions & 1 deletion goi18n/common_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package main

import "os"
import (
"os"
"testing"
)

func mustTempDir(prefix string) string {
outdir, err := os.MkdirTemp("", prefix)
Expand All @@ -9,3 +12,9 @@ func mustTempDir(prefix string) string {
}
return outdir
}

func mustRemoveAll(t *testing.T, path string) {
if err := os.RemoveAll(path); err != nil {
t.Fatal(err)
}
}
6 changes: 3 additions & 3 deletions goi18n/extract_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ zero = "Zero translation"
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
indir := mustTempDir("TestExtractCommandIn")
defer os.RemoveAll(indir)
defer mustRemoveAll(t, indir)
outdir := mustTempDir("TestExtractCommandOut")
defer os.RemoveAll(outdir)
defer mustRemoveAll(t, outdir)

inpath := filepath.Join(indir, test.fileName)
if err := os.WriteFile(inpath, []byte(test.file), 0666); err != nil {
Expand Down Expand Up @@ -342,7 +342,7 @@ func TestExtractCommand(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(outdir)
defer mustRemoveAll(t, outdir)
if code := testableMain([]string{"extract", "-outdir", outdir, "../example/"}); code != 0 {
t.Fatalf("expected exit code 0; got %d", code)
}
Expand Down
2 changes: 1 addition & 1 deletion goi18n/merge_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (mc *mergeCommand) execute() error {
}
for _, path := range ops.deleteFiles {
// Ignore error since it isn't guaranteed to exist.
os.Remove(path)
_ = os.Remove(path)
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions goi18n/merge_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,9 @@ zero = "{{.Count}} unread emails"
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
indir := mustTempDir("TestMergeCommandIn")
defer os.RemoveAll(indir)
defer mustRemoveAll(t, indir)
outdir := mustTempDir("TestMergeCommandOut")
defer os.RemoveAll(outdir)
defer mustRemoveAll(t, outdir)

infiles := make([]string, 0, len(testCase.inFiles))
for name, content := range testCase.inFiles {
Expand Down
4 changes: 2 additions & 2 deletions i18n/message_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (mt *MessageTemplate) Execute(pluralForm plural.Form, data interface{}, fun
if t == nil {
return "", pluralFormNotFoundError{
pluralForm: pluralForm,
messageID: mt.Message.ID,
messageID: mt.ID,
}
}
parser := &template.TextParser{
Expand All @@ -75,7 +75,7 @@ func (mt *MessageTemplate) execute(pluralForm plural.Form, data interface{}, par
if t == nil {
return "", pluralFormNotFoundError{
pluralForm: pluralForm,
messageID: mt.Message.ID,
messageID: mt.ID,
}
}
return t.Execute(parser, data)
Expand Down
2 changes: 1 addition & 1 deletion internal/plural/codegen/xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// Name returns a unique name for this plural group.
func (pg *PluralGroup) Name() string {
n := cases.Title(language.AmericanEnglish).String(pg.Locales)
return strings.Replace(n, " ", "", -1)
return strings.ReplaceAll(n, " ", "")

Check warning on line 29 in internal/plural/codegen/xml.go

View check run for this annotation

Codecov / codecov/patch

internal/plural/codegen/xml.go#L29

Added line #L29 was not covered by tests
}

// SplitLocales returns all the locales in the PluralGroup as a slice.
Expand Down
Loading