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 May 23, 2020
1 parent 6b26ba5 commit 64f6be4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libcontainer/cgroups/cgroupv1/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,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 64f6be4

Please sign in to comment.