Skip to content

Commit

Permalink
libct/cgroupv1/getCgroupMountsHelper: minor nit
Browse files Browse the repository at this point in the history
It is easy to just use TrimPrefix which does nothing in case the prefix
does not exist.

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Jun 16, 2020
1 parent 0626c15 commit cec5ae7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libcontainer/cgroups/v1_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
}
Expand Down

0 comments on commit cec5ae7

Please sign in to comment.