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 20, 2020
1 parent 9e896d7 commit b55fb4f
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 @@ -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++
}
Expand Down

0 comments on commit b55fb4f

Please sign in to comment.