Skip to content

Commit 36d6ff2

Browse files
committed
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 <kolyshkin@gmail.com>
1 parent dba4172 commit 36d6ff2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

libcontainer/cgroups/cgroupv1/utils.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader, all bool) ([]Mount,
147147
continue
148148
}
149149
ss[opt] = true
150-
if strings.HasPrefix(opt, CgroupNamePrefix) {
151-
opt = opt[len(CgroupNamePrefix):]
152-
}
150+
opt = strings.TrimPrefix(opt, CgroupNamePrefix)
153151
m.Subsystems = append(m.Subsystems, opt)
154152
numFound++
155153
}

0 commit comments

Comments
 (0)