CI: make make check clean on macOS (#14528)

Running `make check` on macOS identifies some dead code because the code is used
only with the Linux build tag. Move this code into appropriately-tagged code
files.
This commit is contained in:
Tim Gross
2022-09-09 12:26:34 -04:00
committed by GitHub
parent d2acbd8bdf
commit 8ff79d8a2d
4 changed files with 18 additions and 15 deletions

View File

@@ -8,8 +8,7 @@ import (
)
const (
cgroupAvailable = "available"
cgroupUnavailable = "unavailable"
cgroupUnavailable = "unavailable" // "available" is over in cgroup_linux
cgroupMountPointAttribute = "unique.cgroup.mountpoint"
cgroupVersionAttribute = "unique.cgroup.version"

View File

@@ -6,6 +6,10 @@ import (
"fmt"
)
const (
cgroupAvailable = "available"
)
// Fingerprint tries to find a valid cgroup mount point and the version of cgroups
// if a mount-point is present.
func (f *CGroupFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error {

View File

@@ -2,7 +2,6 @@ package cgutil
import (
"context"
"fmt"
"path/filepath"
"strings"
@@ -61,18 +60,6 @@ type TaskCgroupInfo struct {
Error error
}
// identity is the "<allocID>.<taskName>" string that uniquely identifies an
// individual instance of a task within the flat cgroup namespace
type identity string
func makeID(allocID, task string) identity {
return identity(fmt.Sprintf("%s.%s", allocID, task))
}
func makeScope(id identity) string {
return string(id) + ".scope"
}
// SplitPath determines the parent and cgroup from p.
// p must contain at least 2 elements (parent + cgroup).
//

View File

@@ -4,6 +4,7 @@ package cgutil
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
@@ -314,3 +315,15 @@ func getCPUsFromCgroupV2(group string) ([]uint16, error) {
}
return set.ToSlice(), nil
}
// identity is the "<allocID>.<taskName>" string that uniquely identifies an
// individual instance of a task within the flat cgroup namespace
type identity string
func makeID(allocID, task string) identity {
return identity(fmt.Sprintf("%s.%s", allocID, task))
}
func makeScope(id identity) string {
return string(id) + ".scope"
}