mirror of https://github.com/k3s-io/k3s
Renamed CPUSet.AsSlice() => CPUSet.ToSlice()
parent
8f38abb350
commit
e686ecb6ea
|
@ -140,9 +140,9 @@ func (s CPUSet) Difference(s2 CPUSet) CPUSet {
|
|||
return s.FilterNot(func(cpu int) bool { return s2.Contains(cpu) })
|
||||
}
|
||||
|
||||
// AsSlice returns a slice of integers that contains all elements from
|
||||
// ToSlice returns a slice of integers that contains all elements from
|
||||
// this set.
|
||||
func (s CPUSet) AsSlice() []int {
|
||||
func (s CPUSet) ToSlice() []int {
|
||||
result := []int{}
|
||||
for cpu := range s {
|
||||
result = append(result, cpu)
|
||||
|
@ -160,7 +160,7 @@ func (s CPUSet) String() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
elems := s.AsSlice()
|
||||
elems := s.ToSlice()
|
||||
sort.Ints(elems)
|
||||
|
||||
type rng struct {
|
||||
|
|
|
@ -269,7 +269,7 @@ func TestCPUSetDifference(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCPUSetAsSlice(t *testing.T) {
|
||||
func TestCPUSetToSlice(t *testing.T) {
|
||||
testCases := []struct {
|
||||
set CPUSet
|
||||
expected []int
|
||||
|
@ -280,7 +280,7 @@ func TestCPUSetAsSlice(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, c := range testCases {
|
||||
result := c.set.AsSlice()
|
||||
result := c.set.ToSlice()
|
||||
if !reflect.DeepEqual(result, c.expected) {
|
||||
t.Fatalf("expected set as slice to be [%v] (got [%v]), s: [%v]", c.expected, result, c.set)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue