From 2f51a24af692dc335c3f9bd401a1ab5e19e99859 Mon Sep 17 00:00:00 2001 From: Albert Wolszon Date: Fri, 8 Dec 2023 12:54:35 +0100 Subject: [PATCH] Fix static check issues --- cmd/poe_options_selector.go | 2 +- cmd/seed.go | 2 +- cmd/version.go | 7 ++++--- convert/arb2poe/converter.go | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/poe_options_selector.go b/cmd/poe_options_selector.go index dc0b699..92acc74 100644 --- a/cmd/poe_options_selector.go +++ b/cmd/poe_options_selector.go @@ -153,7 +153,7 @@ func prefixFromTemplateFileName(templateFile string) (string, error) { return "", errors.New( "invalid template-arb-file. Should be a filename with prefix ending " + - "with an underscore followed by a valid BCP-47 locale.", + "with an underscore followed by a valid BCP-47 locale", ) } diff --git a/cmd/seed.go b/cmd/seed.go index 3691571..9cc46d7 100644 --- a/cmd/seed.go +++ b/cmd/seed.go @@ -98,7 +98,7 @@ func runSeed(cmd *cobra.Command, args []string) error { var b bytes.Buffer flutterLocale, err := converter.Convert(&b) if err != nil { - if errors.Is(err, arb2poe.NoTermsError) { + if errors.Is(err, arb2poe.ErrNoTerms) { fileLog.Info("no terms to convert") continue } diff --git a/cmd/version.go b/cmd/version.go index 9624ff7..b685f9d 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -52,11 +52,12 @@ func getVcsInfo() (revision, time string, modified bool, err error) { } for _, setting := range info.Settings { - if setting.Key == "vcs.revision" { + switch setting.Key { + case "vcs.revision": revision = setting.Value - } else if setting.Key == "vcs.time" { + case "vcs.time": time = setting.Value - } else if setting.Key == "vcs.modified" { + case "vcs.modified": modified = setting.Value == "true" } } diff --git a/convert/arb2poe/converter.go b/convert/arb2poe/converter.go index 1c9b03d..e4e9714 100644 --- a/convert/arb2poe/converter.go +++ b/convert/arb2poe/converter.go @@ -26,7 +26,7 @@ func NewConverter(input io.Reader, templateLocale flutter.Locale, termPrefix str } } -var NoTermsError = errors.New("no terms to convert") +var ErrNoTerms = errors.New("no terms to convert") func (c *Converter) Convert(output io.Writer) (lang flutter.Locale, err error) { lang, messages, err := parseARB(c.input) @@ -47,7 +47,7 @@ func (c *Converter) Convert(output io.Writer) (lang flutter.Locale, err error) { } if len(poeTerms) == 0 { - return flutter.Locale{}, NoTermsError + return flutter.Locale{}, ErrNoTerms } err = json.NewEncoder(output).Encode(poeTerms)