mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
cleanup more helper updates (#14638)
* cleanup: refactor MapStringStringSliceValueSet to be cleaner * cleanup: replace SliceStringToSet with actual set * cleanup: replace SliceStringSubset with real set * cleanup: replace SliceStringContains with slices.Contains * cleanup: remove unused function SliceStringHasPrefix * cleanup: fixup StringHasPrefixInSlice doc string * cleanup: refactor SliceSetDisjoint to use real set * cleanup: replace CompareSliceSetString with SliceSetEq * cleanup: replace CompareMapStringString with maps.Equal * cleanup: replace CopyMapStringString with CopyMap * cleanup: replace CopyMapStringInterface with CopyMap * cleanup: fixup more CopyMapStringString and CopyMapStringInt * cleanup: replace CopySliceString with slices.Clone * cleanup: remove unused CopySliceInt * cleanup: refactor CopyMapStringSliceString to be generic as CopyMapOfSlice * cleanup: replace CopyMap with maps.Clone * cleanup: run go mod tidy
This commit is contained in:
@@ -30,6 +30,8 @@ import (
|
||||
"github.com/hashicorp/nomad/helper/escapingfs"
|
||||
"github.com/hashicorp/nomad/version"
|
||||
"github.com/posener/complete"
|
||||
"golang.org/x/exp/maps"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
type OperatorDebugCommand struct {
|
||||
@@ -334,7 +336,7 @@ func ServerPredictor(factory ApiClientFactory) complete.Predictor {
|
||||
func (c *OperatorDebugCommand) queryOpts() *api.QueryOptions {
|
||||
qo := new(api.QueryOptions)
|
||||
*qo = *c.opts
|
||||
qo.Params = helper.CopyMapStringString(c.opts.Params)
|
||||
qo.Params = maps.Clone(c.opts.Params)
|
||||
return qo
|
||||
}
|
||||
|
||||
@@ -1527,7 +1529,7 @@ func filterServerMembers(serverMembers *api.ServerMembers, serverIDs string, reg
|
||||
// "leader" is a special case which Nomad handles in the API. If "leader"
|
||||
// appears in serverIDs, add it to membersFound and remove it from the list
|
||||
// so that it isn't processed by the range loop
|
||||
if helper.SliceStringContains(prefixes, "leader") {
|
||||
if slices.Contains(prefixes, "leader") {
|
||||
membersFound = append(membersFound, "leader")
|
||||
helper.RemoveEqualFold(&prefixes, "leader")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user