mirror of
https://github.com/containers/podman.git
synced 2025-10-18 03:33:32 +08:00
Replace strings.SplitN with strings.Cut
Cut is a cleaner & more performant api relative to SplitN(_, _, 2) added in go 1.18 Previously applied this refactoring to buildah: https://github.com/containers/buildah/pull/5239 Signed-off-by: Philip Dubé <philip@peerdb.io>
This commit is contained in:
@ -40,9 +40,9 @@ func parseUserInput(input string) (container string, path string) {
|
||||
return
|
||||
}
|
||||
|
||||
if spl := strings.SplitN(path, ":", 2); len(spl) == 2 {
|
||||
container = spl[0]
|
||||
path = spl[1]
|
||||
if parsedContainer, parsedPath, ok := strings.Cut(path, ":"); ok {
|
||||
container = parsedContainer
|
||||
path = parsedPath
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user