Skip to content

Commit

Permalink
Fix key appends
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalmi committed Nov 17, 2022
1 parent 5777b2a commit da1a0ad
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions helper/builtinplugins/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit da1a0ad

Please sign in to comment.