Skip to content

Commit c5ff6ba

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 768ce30 commit c5ff6ba

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
@@ -151,9 +151,7 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader, all bool) ([]Mount,
151151
continue
152152
}
153153
ss[opt] = true
154-
if strings.HasPrefix(opt, CgroupNamePrefix) {
155-
opt = opt[len(CgroupNamePrefix):]
156-
}
154+
opt = strings.TrimPrefix(opt, CgroupNamePrefix)
157155
m.Subsystems = append(m.Subsystems, opt)
158156
numFound++
159157
}

0 commit comments

Comments
 (0)