From f4845240cc28264636714dc92d357a8db1213835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Wed, 29 Jul 2020 01:17:05 +0200 Subject: [PATCH] fixed typo and lint errors --- daemon/core/core.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/daemon/core/core.go b/daemon/core/core.go index ccc2033ccc..70d923f6e7 100644 --- a/daemon/core/core.go +++ b/daemon/core/core.go @@ -1,7 +1,6 @@ package core import ( - "fmt" "os" "os/exec" "os/user" @@ -13,10 +12,12 @@ const ( defaultTrimSet = "\r\n\t " ) +// Trim remove trailing spaces from a string. func Trim(s string) string { return strings.Trim(s, defaultTrimSet) } +// Exec spawns a new process and reurns the output. func Exec(executable string, args []string) (string, error) { path, err := exec.LookPath(executable) if err != nil { @@ -26,11 +27,11 @@ func Exec(executable string, args []string) (string, error) { raw, err := exec.Command(path, args...).CombinedOutput() if err != nil { return "", err - } else { - return Trim(string(raw)), nil } + return Trim(string(raw)), nil } +// Exists checks if a path exists. func Exists(path string) bool { if _, err := os.Stat(path); os.IsNotExist(err) { return false @@ -38,6 +39,7 @@ func Exists(path string) bool { return true } +// ExpandPath replaces '~' shorthand with the user's home directory. func ExpandPath(path string) (string, error) { // Check if path is empty if path != "" {