You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/testing/deployer/topology/util.go

21 lines
350 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package topology
func MergeSlices[V any](x, y []V) []V {
switch {
case len(x) == 0 && len(y) == 0:
return nil
case len(x) == 0:
return y
case len(y) == 0:
return x
}
out := make([]V, 0, len(x)+len(y))
out = append(out, x...)
out = append(out, y...)
return out
}