fix(build/llu): fix golang lint errors

This commit is contained in:
Ellen Emilia Anna Zscheile 2025-03-12 22:31:44 +01:00
parent 7fced29615
commit 508c5b39e2
2 changed files with 10 additions and 10 deletions

View file

@ -221,11 +221,10 @@ func (omh OnMsgidHandler) HandleTemplateFile(fname string, src any) error {
Kind: "Template parser", Kind: "Template parser",
Err: err, Err: err,
} }
} else { }
omh.handleTemplateFileNodes(fset, tmplParsed.Tree.Root.Nodes) omh.handleTemplateFileNodes(fset, tmplParsed.Tree.Root.Nodes)
return nil return nil
} }
}
// This command assumes that we get started from the project root directory // This command assumes that we get started from the project root directory
// //
@ -240,11 +239,12 @@ func (omh OnMsgidHandler) HandleTemplateFile(fname string, src any) error {
// 2 unable to parse locale ini/json files // 2 unable to parse locale ini/json files
// 3 unable to parse go or text/template files // 3 unable to parse go or text/template files
// 4 found missing message IDs // 4 found missing message IDs
//
//nolint:forbidigo
func main() { func main() {
allowMissingMsgids := false allowMissingMsgids := false
for _, arg := range os.Args { for _, arg := range os.Args[1:] {
switch arg { if arg == "--allow-missing-msgids" {
case "--allow-missing-msgids":
allowMissingMsgids = true allowMissingMsgids = true
} }
} }

View file

@ -32,13 +32,13 @@ func HandleTemplateFileWrapped(t *testing.T, fname, src string) []string {
func TestUsagesParser(t *testing.T) { func TestUsagesParser(t *testing.T) {
t.Run("go, simple", func(t *testing.T) { t.Run("go, simple", func(t *testing.T) {
assert.EqualValues(t, assert.EqualValues(t,
HandleGoFileWrapped(t, "<g1>", "package main\nfunc Render(ctx *context.Context) string { return ctx.Tr(\"what.an.example\"); }\n"), []string{"what.an.example"},
[]string{"what.an.example"}) HandleGoFileWrapped(t, "<g1>", "package main\nfunc Render(ctx *context.Context) string { return ctx.Tr(\"what.an.example\"); }\n"))
}) })
t.Run("template, simple", func(t *testing.T) { t.Run("template, simple", func(t *testing.T) {
assert.EqualValues(t, assert.EqualValues(t,
HandleTemplateFileWrapped(t, "<t1>", "{{ ctx.Locale.Tr \"what.an.example\" }}\n"), []string{"what.an.example"},
[]string{"what.an.example"}) HandleTemplateFileWrapped(t, "<t1>", "{{ ctx.Locale.Tr \"what.an.example\" }}\n"))
}) })
} }