From cec5ae7c2d1dbba7e92fbb87040119f30c3f3bc1 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 19 May 2020 15:09:04 -0700 Subject: [PATCH] libct/cgroupv1/getCgroupMountsHelper: minor nit It is easy to just use TrimPrefix which does nothing in case the prefix does not exist. Signed-off-by: Kir Kolyshkin --- libcontainer/cgroups/v1_utils.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libcontainer/cgroups/v1_utils.go b/libcontainer/cgroups/v1_utils.go index e32c48a5..f8487b0a 100644 --- a/libcontainer/cgroups/v1_utils.go +++ b/libcontainer/cgroups/v1_utils.go @@ -141,9 +141,7 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader, all bool) ([]Mount, continue } ss[opt] = true - if strings.HasPrefix(opt, CgroupNamePrefix) { - opt = opt[len(CgroupNamePrefix):] - } + opt = strings.TrimPrefix(opt, CgroupNamePrefix) m.Subsystems = append(m.Subsystems, opt) numFound++ }