fix lint errors

This commit is contained in:
Nicholas Orlowsky 2024-05-18 02:44:18 +02:00
parent 9e79a36020
commit ac0f6fcd39
No known key found for this signature in database
GPG key ID: 838827D8C4611687
2 changed files with 38 additions and 19 deletions

View file

@ -64,14 +64,13 @@ func GetCgroupVersion() int64 {
// /sys/fs/cgroup/cgroup.controllers will not exist with cgroupsv1
if _, err := os.Stat("/sys/fs/cgroup/cgroup.controllers"); err == nil {
return 2
} else {
return 1
}
return 1
}
func readCgroup2FileToInt64Tuple(cgroupFile string) (int64, int64) {
contents, err := os.ReadFile(filepath.Join("/sys/fs/cgroup/", cgroupFile))
func readCgroup2FileToInt64Tuple(cgroupFile string) (quota, period int64) {
contents, err := os.ReadFile(filepath.Join(string(os.PathSeparator), "sys", "fs", "cgroup", cgroupFile))
if err != nil {
return -1, -1
}
@ -87,7 +86,6 @@ func readCgroup2FileToInt64Tuple(cgroupFile string) (int64, int64) {
}
cpuQuota, err := strconv.ParseInt(values[0], 10, 64)
if err != nil {
return -1, -1
}
@ -97,7 +95,6 @@ func readCgroup2FileToInt64Tuple(cgroupFile string) (int64, int64) {
}
cpuPeriod, err := strconv.ParseInt(values[1], 10, 64)
if err != nil {
return -1, -1
}