From 5c7e8981861f43af81fd65c9319af92cb98cbc13 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 14 Dec 2021 13:06:11 -0800 Subject: [PATCH] libct/cg: rm go 1.15 compatibility Since commit 12e99a0f8df0e6ac59 we do require Go >= 1.16, so this file is no longer needed. Also, this actually ensures that go >= 1.16 is used (otherwise libcontainer/cgroups/getallpids.go won't compile). Signed-off-by: Kir Kolyshkin --- libcontainer/cgroups/getallpids.go | 3 --- libcontainer/cgroups/getallpids_go115.go | 31 ------------------------ 2 files changed, 34 deletions(-) delete mode 100644 libcontainer/cgroups/getallpids_go115.go diff --git a/libcontainer/cgroups/getallpids.go b/libcontainer/cgroups/getallpids.go index 09c01fb6f..1355a5101 100644 --- a/libcontainer/cgroups/getallpids.go +++ b/libcontainer/cgroups/getallpids.go @@ -1,6 +1,3 @@ -//go:build go1.16 -// +build go1.16 - package cgroups import ( diff --git a/libcontainer/cgroups/getallpids_go115.go b/libcontainer/cgroups/getallpids_go115.go deleted file mode 100644 index 6b645ef64..000000000 --- a/libcontainer/cgroups/getallpids_go115.go +++ /dev/null @@ -1,31 +0,0 @@ -//go:build !go1.16 -// +build !go1.16 - -package cgroups - -import ( - "os" - "path/filepath" -) - -// GetAllPids returns all pids, that were added to cgroup at path and to all its -// subcgroups. -func GetAllPids(path string) ([]int, error) { - var pids []int - // collect pids from all sub-cgroups - err := filepath.Walk(path, func(p string, info os.FileInfo, iErr error) error { - if iErr != nil { - return iErr - } - if !info.IsDir() { - return nil - } - cPids, err := readProcsFile(p) - if err != nil { - return err - } - pids = append(pids, cPids...) - return nil - }) - return pids, err -}