From b55fb4fa983130810eecd3e461465f84a374590a 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/cgroupv1/utils.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libcontainer/cgroups/cgroupv1/utils.go b/libcontainer/cgroups/cgroupv1/utils.go index 0cf2489ac64..86a66bf1db8 100644 --- a/libcontainer/cgroups/cgroupv1/utils.go +++ b/libcontainer/cgroups/cgroupv1/utils.go @@ -151,9 +151,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++ }