From a11df0b702f9a57fcdced15be67e4c8a585ff3a6 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Tue, 19 Sep 2017 11:03:53 +0100 Subject: [PATCH] check: Fix golint errors. golint is now causing builds to fail due to the need to simplify certain functions that return errors. Fixes #573. Signed-off-by: James O. D. Hunt --- cc-check.go | 6 +----- create.go | 6 +----- kill.go | 6 +----- list.go | 6 ++---- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/cc-check.go b/cc-check.go index 346010d7..a473fe26 100644 --- a/cc-check.go +++ b/cc-check.go @@ -234,11 +234,7 @@ func hostIsClearContainersCapable(cpuinfoFile string) error { return err } - if err = checkKernelModules(requiredKernelModules); err != nil { - return err - } - - return nil + return checkKernelModules(requiredKernelModules) } var ccCheckCLICommand = cli.Command{ diff --git a/create.go b/create.go index 75f78874..9c7f59c2 100644 --- a/create.go +++ b/create.go @@ -140,11 +140,7 @@ func create(containerID, bundlePath, console, pidFilePath string, detach bool, // Creation of PID file has to be the last thing done in the create // because containerd considers the create complete after this file // is created. - if err := createPIDFile(pidFilePath, process.Pid); err != nil { - return err - } - - return nil + return createPIDFile(pidFilePath, process.Pid) } func getKernelParams(containerID string) []vc.Param { diff --git a/kill.go b/kill.go index 18e9591a..3bca04e5 100644 --- a/kill.go +++ b/kill.go @@ -116,11 +116,7 @@ func kill(containerID, signal string, all bool) error { return fmt.Errorf("Container %s not ready or running, cannot send a signal", containerID) } - if err := vci.KillContainer(podID, containerID, signum, all); err != nil { - return err - } - - return nil + return vci.KillContainer(podID, containerID, signum, all) } func processSignal(signal string) (syscall.Signal, error) { diff --git a/list.go b/list.go index 4cafd6dd..c5a24995 100644 --- a/list.go +++ b/list.go @@ -178,10 +178,8 @@ func (f *formatTabular) Write(state []fullContainerState, showAll bool, file *os fmt.Fprintf(w, "\n") } } - if err := w.Flush(); err != nil { - return err - } - return nil + + return w.Flush() } func (f *formatJSON) Write(state []fullContainerState, showAll bool, file *os.File) error {