From db826d5d75630cca784bd7092eba5b06601ae27f Mon Sep 17 00:00:00 2001 From: baude Date: Thu, 11 Jul 2019 05:44:12 -0500 Subject: golangci-lint round #3 this is the third round of preparing to use the golangci-lint on our code base. Signed-off-by: baude --- pkg/cgroups/cgroups.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'pkg/cgroups') diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go index fda19bff8..f2c6b548e 100644 --- a/pkg/cgroups/cgroups.go +++ b/pkg/cgroups/cgroups.go @@ -155,7 +155,7 @@ func createCgroupv2Path(path string) (Err error) { if err != nil { return errors.Wrapf(err, "read /sys/fs/cgroup/cgroup.controllers") } - if !filepath.HasPrefix(path, "/sys/fs/cgroup") { + if !strings.HasPrefix(path, "/sys/fs/cgroup/") { return fmt.Errorf("invalid cgroup path %s", path) } @@ -274,12 +274,6 @@ func readFileAsUint64(path string) (uint64, error) { return ret, nil } -func (c *CgroupControl) writePidToTasks(pid int, name string) error { - path := filepath.Join(c.getCgroupv1Path(name), "tasks") - payload := []byte(fmt.Sprintf("%d", pid)) - return ioutil.WriteFile(path, payload, 0644) -} - // New creates a new cgroup control func New(path string, resources *spec.LinuxResources) (*CgroupControl, error) { cgroup2, err := IsCgroup2UnifiedMode() @@ -384,7 +378,7 @@ func rmDirRecursively(path string) error { } } } - if os.Remove(path); err != nil { + if err := os.Remove(path); err != nil { if !os.IsNotExist(err) { return errors.Wrapf(err, "remove %s", path) } -- cgit v1.2.3-54-g00ecf