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 <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed May 19, 2020
1 parent 46d55b6 commit 5fa4cf9
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 5fa4cf9

Please sign in to comment.