mirror of
https://github.com/containers/podman.git
synced 2025-10-17 19:24:04 +08:00
Merge pull request #13973 from Luap99/linter-revive
replace golint with revive linter
This commit is contained in:
@ -231,14 +231,14 @@ func ParseNamespace(ns string) (Namespace, error) {
|
||||
case strings.HasPrefix(ns, "ns:"):
|
||||
split := strings.SplitN(ns, ":", 2)
|
||||
if len(split) != 2 {
|
||||
return toReturn, errors.Errorf("must provide a path to a namespace when specifying ns:")
|
||||
return toReturn, errors.Errorf("must provide a path to a namespace when specifying \"ns:\"")
|
||||
}
|
||||
toReturn.NSMode = Path
|
||||
toReturn.Value = split[1]
|
||||
case strings.HasPrefix(ns, "container:"):
|
||||
split := strings.SplitN(ns, ":", 2)
|
||||
if len(split) != 2 {
|
||||
return toReturn, errors.Errorf("must provide name or ID or a container when specifying container:")
|
||||
return toReturn, errors.Errorf("must provide name or ID or a container when specifying \"container:\"")
|
||||
}
|
||||
toReturn.NSMode = FromContainer
|
||||
toReturn.Value = split[1]
|
||||
@ -349,14 +349,14 @@ func ParseNetworkNamespace(ns string, rootlessDefaultCNI bool) (Namespace, map[s
|
||||
case strings.HasPrefix(ns, "ns:"):
|
||||
split := strings.SplitN(ns, ":", 2)
|
||||
if len(split) != 2 {
|
||||
return toReturn, nil, errors.Errorf("must provide a path to a namespace when specifying ns:")
|
||||
return toReturn, nil, errors.Errorf("must provide a path to a namespace when specifying \"ns:\"")
|
||||
}
|
||||
toReturn.NSMode = Path
|
||||
toReturn.Value = split[1]
|
||||
case strings.HasPrefix(ns, string(FromContainer)+":"):
|
||||
split := strings.SplitN(ns, ":", 2)
|
||||
if len(split) != 2 {
|
||||
return toReturn, nil, errors.Errorf("must provide name or ID or a container when specifying container:")
|
||||
return toReturn, nil, errors.Errorf("must provide name or ID or a container when specifying \"container:\"")
|
||||
}
|
||||
toReturn.NSMode = FromContainer
|
||||
toReturn.Value = split[1]
|
||||
@ -427,14 +427,14 @@ func ParseNetworkFlag(networks []string) (Namespace, map[string]types.PerNetwork
|
||||
case strings.HasPrefix(ns, "ns:"):
|
||||
split := strings.SplitN(ns, ":", 2)
|
||||
if len(split) != 2 {
|
||||
return toReturn, nil, nil, errors.Errorf("must provide a path to a namespace when specifying ns:")
|
||||
return toReturn, nil, nil, errors.Errorf("must provide a path to a namespace when specifying \"ns:\"")
|
||||
}
|
||||
toReturn.NSMode = Path
|
||||
toReturn.Value = split[1]
|
||||
case strings.HasPrefix(ns, string(FromContainer)+":"):
|
||||
split := strings.SplitN(ns, ":", 2)
|
||||
if len(split) != 2 {
|
||||
return toReturn, nil, nil, errors.Errorf("must provide name or ID or a container when specifying container:")
|
||||
return toReturn, nil, nil, errors.Errorf("must provide name or ID or a container when specifying \"container:\"")
|
||||
}
|
||||
toReturn.NSMode = FromContainer
|
||||
toReturn.Value = split[1]
|
||||
|
Reference in New Issue
Block a user