Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e686ecb6
Commit
e686ecb6
authored
Aug 22, 2017
by
Connor Doyle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed CPUSet.AsSlice() => CPUSet.ToSlice()
parent
8f38abb3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
cpuset.go
pkg/kubelet/cm/cpuset/cpuset.go
+3
-3
cpuset_test.go
pkg/kubelet/cm/cpuset/cpuset_test.go
+2
-2
No files found.
pkg/kubelet/cm/cpuset/cpuset.go
View file @
e686ecb6
...
@@ -140,9 +140,9 @@ func (s CPUSet) Difference(s2 CPUSet) CPUSet {
...
@@ -140,9 +140,9 @@ func (s CPUSet) Difference(s2 CPUSet) CPUSet {
return
s
.
FilterNot
(
func
(
cpu
int
)
bool
{
return
s2
.
Contains
(
cpu
)
})
return
s
.
FilterNot
(
func
(
cpu
int
)
bool
{
return
s2
.
Contains
(
cpu
)
})
}
}
//
As
Slice returns a slice of integers that contains all elements from
//
To
Slice returns a slice of integers that contains all elements from
// this set.
// this set.
func
(
s
CPUSet
)
As
Slice
()
[]
int
{
func
(
s
CPUSet
)
To
Slice
()
[]
int
{
result
:=
[]
int
{}
result
:=
[]
int
{}
for
cpu
:=
range
s
{
for
cpu
:=
range
s
{
result
=
append
(
result
,
cpu
)
result
=
append
(
result
,
cpu
)
...
@@ -160,7 +160,7 @@ func (s CPUSet) String() string {
...
@@ -160,7 +160,7 @@ func (s CPUSet) String() string {
return
""
return
""
}
}
elems
:=
s
.
As
Slice
()
elems
:=
s
.
To
Slice
()
sort
.
Ints
(
elems
)
sort
.
Ints
(
elems
)
type
rng
struct
{
type
rng
struct
{
...
...
pkg/kubelet/cm/cpuset/cpuset_test.go
View file @
e686ecb6
...
@@ -269,7 +269,7 @@ func TestCPUSetDifference(t *testing.T) {
...
@@ -269,7 +269,7 @@ func TestCPUSetDifference(t *testing.T) {
}
}
}
}
func
TestCPUSet
As
Slice
(
t
*
testing
.
T
)
{
func
TestCPUSet
To
Slice
(
t
*
testing
.
T
)
{
testCases
:=
[]
struct
{
testCases
:=
[]
struct
{
set
CPUSet
set
CPUSet
expected
[]
int
expected
[]
int
...
@@ -280,7 +280,7 @@ func TestCPUSetAsSlice(t *testing.T) {
...
@@ -280,7 +280,7 @@ func TestCPUSetAsSlice(t *testing.T) {
}
}
for
_
,
c
:=
range
testCases
{
for
_
,
c
:=
range
testCases
{
result
:=
c
.
set
.
As
Slice
()
result
:=
c
.
set
.
To
Slice
()
if
!
reflect
.
DeepEqual
(
result
,
c
.
expected
)
{
if
!
reflect
.
DeepEqual
(
result
,
c
.
expected
)
{
t
.
Fatalf
(
"expected set as slice to be [%v] (got [%v]), s: [%v]"
,
c
.
expected
,
result
,
c
.
set
)
t
.
Fatalf
(
"expected set as slice to be [%v] (got [%v]), s: [%v]"
,
c
.
expected
,
result
,
c
.
set
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment