From d713652bdaedd1aff1a63cde672655001191e7fb Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 25 Sep 2017 10:41:57 +0200 Subject: [PATCH] libcontainer: remove unnecessary type conversions Generated using github.com/mdempsky/unconvert Signed-off-by: Tobias Klauser --- libcontainer/container_linux.go | 4 ++-- libcontainer/init_linux.go | 4 ++-- libcontainer/keys/keyctl.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index bf892b77..e8e46e56 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -670,9 +670,9 @@ func parseCriuVersion(path string) (int, error) { return 0, fmt.Errorf("Unable to parse the CRIU version: %s", path) } - n, err := fmt.Sscanf(string(version), "GitID: v%d.%d.%d", &x, &y, &z) // 1.5.2 + n, err := fmt.Sscanf(version, "GitID: v%d.%d.%d", &x, &y, &z) // 1.5.2 if err != nil { - n, err = fmt.Sscanf(string(version), "GitID: v%d.%d", &x, &y) // 1.6 + n, err = fmt.Sscanf(version, "GitID: v%d.%d", &x, &y) // 1.6 y++ } else { z++ diff --git a/libcontainer/init_linux.go b/libcontainer/init_linux.go index 8c06dae6..59c4e372 100644 --- a/libcontainer/init_linux.go +++ b/libcontainer/init_linux.go @@ -260,10 +260,10 @@ func setupUser(config *initConfig) error { // Rather than just erroring out later in setuid(2) and setgid(2), check // that the user is mapped here. - if _, err := config.Config.HostUID(int(execUser.Uid)); err != nil { + if _, err := config.Config.HostUID(execUser.Uid); err != nil { return fmt.Errorf("cannot set uid to unmapped user in user namespace") } - if _, err := config.Config.HostGID(int(execUser.Gid)); err != nil { + if _, err := config.Config.HostGID(execUser.Gid); err != nil { return fmt.Errorf("cannot set gid to unmapped user in user namespace") } diff --git a/libcontainer/keys/keyctl.go b/libcontainer/keys/keyctl.go index 82ffa7a8..ce8b4e6b 100644 --- a/libcontainer/keys/keyctl.go +++ b/libcontainer/keys/keyctl.go @@ -29,7 +29,7 @@ func ModKeyringPerm(ringId KeySerial, mask, setbits uint32) error { return err } - res := strings.Split(string(dest), ";") + res := strings.Split(dest, ";") if len(res) < 5 { return fmt.Errorf("Destination buffer for key description is too small") }