From c951220b4ebf0fb98db76aa72aa5e4458c6d0279 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Wed, 28 Feb 2024 06:56:53 -0500 Subject: [PATCH] fix(golang-rewrite): address linter errors --- plugins/main.go | 8 ++++---- plugins/main_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/main.go b/plugins/main.go index b1e5b3c3..dd3c7e77 100644 --- a/plugins/main.go +++ b/plugins/main.go @@ -13,7 +13,7 @@ import ( const dataDirPlugins = "plugins" const invalidPluginNameMsg = "'%q' is invalid. Name may only contain lowercase letters, numbers, '_', and '-'" -const pluginAlreadyExists = "Plugin named %q already added" +const pluginAlreadyExists = "plugin named %q already added" func PluginAdd(config config.Config, pluginName, pluginUrl string) error { err := validatePluginName(pluginName) @@ -25,7 +25,7 @@ func PluginAdd(config config.Config, pluginName, pluginUrl string) error { exists, err := PluginExists(config.DataDir, pluginName) if err != nil { - return fmt.Errorf("Unable to check if plugin already exists: %w", err) + return fmt.Errorf("unable to check if plugin already exists: %w", err) } if exists { @@ -35,7 +35,7 @@ func PluginAdd(config config.Config, pluginName, pluginUrl string) error { pluginDir := PluginDirectory(config.DataDir, pluginName) if err != nil { - return fmt.Errorf("Unable to create plugin directory: %w", err) + return fmt.Errorf("unable to create plugin directory: %w", err) } _, err = git.PlainClone(pluginDir, false, &git.CloneOptions{ @@ -43,7 +43,7 @@ func PluginAdd(config config.Config, pluginName, pluginUrl string) error { }) if err != nil { - return fmt.Errorf("Unable to clone plugin: %w", err) + return fmt.Errorf("unable to clone plugin: %w", err) } return nil diff --git a/plugins/main_test.go b/plugins/main_test.go index 54c8ba53..abb84108 100644 --- a/plugins/main_test.go +++ b/plugins/main_test.go @@ -50,7 +50,7 @@ func TestPluginAdd(t *testing.T) { t.Fatal("expected error got nil") } - expectedErrMsg := "Plugin named \"lua\" already added" + expectedErrMsg := "plugin named \"lua\" already added" if !strings.Contains(err.Error(), expectedErrMsg) { t.Errorf("Expected an error with message %v", expectedErrMsg) } @@ -61,7 +61,7 @@ func TestPluginAdd(t *testing.T) { err := PluginAdd(conf, "foo", "foobar") - assert.ErrorContains(t, err, "Unable to clone plugin: repository not found") + assert.ErrorContains(t, err, "unable to clone plugin: repository not found") }) t.Run("when plugin name and URL are valid installs plugin", func(t *testing.T) {