diff --git a/cli-plugins/manager/error.go b/cli-plugins/manager/error.go index 1b5f4f60e..04bf3decb 100644 --- a/cli-plugins/manager/error.go +++ b/cli-plugins/manager/error.go @@ -47,8 +47,8 @@ func wrapAsPluginError(err error, msg string) error { return &pluginError{cause: fmt.Errorf("%s: %w", msg, err)} } -// NewPluginError creates a new pluginError, analogous to +// newPluginError creates a new pluginError, analogous to // errors.Errorf. -func NewPluginError(msg string, args ...any) error { +func newPluginError(msg string, args ...any) error { return &pluginError{cause: fmt.Errorf(msg, args...)} } diff --git a/cli-plugins/manager/error_test.go b/cli-plugins/manager/error_test.go index c4cb19bd5..682860daa 100644 --- a/cli-plugins/manager/error_test.go +++ b/cli-plugins/manager/error_test.go @@ -10,7 +10,7 @@ import ( ) func TestPluginError(t *testing.T) { - err := NewPluginError("new error") + err := newPluginError("new error") assert.Check(t, is.Error(err, "new error")) inner := errors.New("testing") diff --git a/cli-plugins/manager/plugin.go b/cli-plugins/manager/plugin.go index e72d9039b..2caae39b0 100644 --- a/cli-plugins/manager/plugin.go +++ b/cli-plugins/manager/plugin.go @@ -86,7 +86,7 @@ func newPlugin(c pluginCandidate, cmds []*cobra.Command) (Plugin, error) { // Now apply the candidate tests, so these update p.Err. if !pluginNameRe.MatchString(p.Name) { - p.Err = NewPluginError("plugin candidate %q did not match %q", p.Name, pluginNameRe.String()) + p.Err = newPluginError("plugin candidate %q did not match %q", p.Name, pluginNameRe.String()) return p, nil } @@ -98,11 +98,11 @@ func newPlugin(c pluginCandidate, cmds []*cobra.Command) (Plugin, error) { continue } if cmd.Name() == p.Name { - p.Err = NewPluginError("plugin %q duplicates builtin command", p.Name) + p.Err = newPluginError("plugin %q duplicates builtin command", p.Name) return p, nil } if cmd.HasAlias(p.Name) { - p.Err = NewPluginError("plugin %q duplicates an alias of builtin command %q", p.Name, cmd.Name()) + p.Err = newPluginError("plugin %q duplicates an alias of builtin command %q", p.Name, cmd.Name()) return p, nil } } @@ -119,11 +119,11 @@ func newPlugin(c pluginCandidate, cmds []*cobra.Command) (Plugin, error) { return p, nil } if p.Metadata.SchemaVersion != "0.1.0" { - p.Err = NewPluginError("plugin SchemaVersion %q is not valid, must be 0.1.0", p.Metadata.SchemaVersion) + p.Err = newPluginError("plugin SchemaVersion %q is not valid, must be 0.1.0", p.Metadata.SchemaVersion) return p, nil } if p.Metadata.Vendor == "" { - p.Err = NewPluginError("plugin metadata does not define a vendor") + p.Err = newPluginError("plugin metadata does not define a vendor") return p, nil } return p, nil diff --git a/cli-plugins/manager/plugin_test.go b/cli-plugins/manager/plugin_test.go index 84d71d518..ace51c12c 100644 --- a/cli-plugins/manager/plugin_test.go +++ b/cli-plugins/manager/plugin_test.go @@ -29,7 +29,7 @@ func TestPluginMarshal(t *testing.T) { }, { doc: "custom error", - error: NewPluginError("something went wrong"), + error: newPluginError("something went wrong"), expected: jsonWithError, }, }