MCPcopy
hub / github.com/redis/go-redis / appendIfNotExist

Function appendIfNotExist

osscluster.go:2522–2529  ·  view source on GitHub ↗
(vals []T, newVal T)

Source from the content-addressed store, hash-verified

2520}
2521
2522func appendIfNotExist[T comparable](vals []T, newVal T) []T {
2523 for _, v := range vals {
2524 if v == newVal {
2525 return vals
2526 }
2527 }
2528 return append(vals, newVal)
2529}
2530
2531//------------------------------------------------------------------------------
2532

Callers 2

newClusterStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected