From da1a0ad5c99d0b6c0d3c40c7b5050f1f9df8981d Mon Sep 17 00:00:00 2001 From: Mike Palmiotto Date: Thu, 17 Nov 2022 10:52:42 -0500 Subject: [PATCH] Fix key appends --- helper/builtinplugins/registry.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/helper/builtinplugins/registry.go b/helper/builtinplugins/registry.go index f8e05a571f85..be551b30d409 100644 --- a/helper/builtinplugins/registry.go +++ b/helper/builtinplugins/registry.go @@ -214,15 +214,15 @@ func (r *registry) Keys(pluginType consts.PluginType) []string { switch pluginType { case consts.PluginTypeDatabase: for key, backend := range r.databasePlugins { - appendIfNotRemoved(&keys, key, backend.DeprecationStatus) + keys = appendIfNotRemoved(keys, key, backend.DeprecationStatus) } case consts.PluginTypeCredential: for key, backend := range r.credentialBackends { - appendIfNotRemoved(&keys, key, backend.DeprecationStatus) + keys = appendIfNotRemoved(keys, key, backend.DeprecationStatus) } case consts.PluginTypeSecrets: for key, backend := range r.logicalBackends { - appendIfNotRemoved(&keys, key, backend.DeprecationStatus) + keys = appendIfNotRemoved(keys, key, backend.DeprecationStatus) } } return keys @@ -265,8 +265,9 @@ func toFunc(ifc interface{}) func() (interface{}, error) { } } -func appendIfNotRemoved(keys *[]string, name string, status consts.DeprecationStatus) { +func appendIfNotRemoved(keys []string, name string, status consts.DeprecationStatus) []string { if status != consts.Removed { - *keys = append(*keys, name) + return append(keys, name) } + return keys }