summaryrefslogtreecommitdiff
path: root/pkg/util
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-01-13 13:01:45 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-01-13 14:27:02 +0100
commit67165b76753f65b6f58d471f314678ae12a4c722 (patch)
tree72580ee08e5d9d2e57b97a7293deaf8a2a0f2e67 /pkg/util
parent270d892c3d77de4fd8e6341193175c0572fb5f99 (diff)
downloadpodman-67165b76753f65b6f58d471f314678ae12a4c722.tar.gz
podman-67165b76753f65b6f58d471f314678ae12a4c722.tar.bz2
podman-67165b76753f65b6f58d471f314678ae12a4c722.zip
make lint: enable gocritic
`gocritic` is a powerful linter that helps in preventing certain kinds of errors as well as enforcing a coding style. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/util')
-rw-r--r--pkg/util/utils.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index 9269f6115..6aa3c221e 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -321,14 +321,14 @@ func ParseSignal(rawSignal string) (syscall.Signal, error) {
}
// ParseIDMapping takes idmappings and subuid and subgid maps and returns a storage mapping
-func ParseIDMapping(mode namespaces.UsernsMode, UIDMapSlice, GIDMapSlice []string, subUIDMap, subGIDMap string) (*storage.IDMappingOptions, error) {
+func ParseIDMapping(mode namespaces.UsernsMode, uidMapSlice, gidMapSlice []string, subUIDMap, subGIDMap string) (*storage.IDMappingOptions, error) {
options := storage.IDMappingOptions{
HostUIDMapping: true,
HostGIDMapping: true,
}
if mode.IsKeepID() {
- if len(UIDMapSlice) > 0 || len(GIDMapSlice) > 0 {
+ if len(uidMapSlice) > 0 || len(gidMapSlice) > 0 {
return nil, errors.New("cannot specify custom mappings with --userns=keep-id")
}
if len(subUIDMap) > 0 || len(subGIDMap) > 0 {
@@ -384,17 +384,17 @@ func ParseIDMapping(mode namespaces.UsernsMode, UIDMapSlice, GIDMapSlice []strin
if subUIDMap == "" && subGIDMap != "" {
subUIDMap = subGIDMap
}
- if len(GIDMapSlice) == 0 && len(UIDMapSlice) != 0 {
- GIDMapSlice = UIDMapSlice
+ if len(gidMapSlice) == 0 && len(uidMapSlice) != 0 {
+ gidMapSlice = uidMapSlice
}
- if len(UIDMapSlice) == 0 && len(GIDMapSlice) != 0 {
- UIDMapSlice = GIDMapSlice
+ if len(uidMapSlice) == 0 && len(gidMapSlice) != 0 {
+ uidMapSlice = gidMapSlice
}
- if len(UIDMapSlice) == 0 && subUIDMap == "" && os.Getuid() != 0 {
- UIDMapSlice = []string{fmt.Sprintf("0:%d:1", os.Getuid())}
+ if len(uidMapSlice) == 0 && subUIDMap == "" && os.Getuid() != 0 {
+ uidMapSlice = []string{fmt.Sprintf("0:%d:1", os.Getuid())}
}
- if len(GIDMapSlice) == 0 && subGIDMap == "" && os.Getuid() != 0 {
- GIDMapSlice = []string{fmt.Sprintf("0:%d:1", os.Getgid())}
+ if len(gidMapSlice) == 0 && subGIDMap == "" && os.Getuid() != 0 {
+ gidMapSlice = []string{fmt.Sprintf("0:%d:1", os.Getgid())}
}
if subUIDMap != "" && subGIDMap != "" {
@@ -405,11 +405,11 @@ func ParseIDMapping(mode namespaces.UsernsMode, UIDMapSlice, GIDMapSlice []strin
options.UIDMap = mappings.UIDs()
options.GIDMap = mappings.GIDs()
}
- parsedUIDMap, err := idtools.ParseIDMap(UIDMapSlice, "UID")
+ parsedUIDMap, err := idtools.ParseIDMap(uidMapSlice, "UID")
if err != nil {
return nil, err
}
- parsedGIDMap, err := idtools.ParseIDMap(GIDMapSlice, "GID")
+ parsedGIDMap, err := idtools.ParseIDMap(gidMapSlice, "GID")
if err != nil {
return nil, err
}