Skip to content

Commit

Permalink
fixed typo and lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-iniguez-goya committed Jul 28, 2020
1 parent 00b249a commit f484524
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions daemon/core/core.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package core

import (
"fmt"
"os"
"os/exec"
"os/user"
Expand All @@ -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 {
Expand All @@ -26,18 +27,19 @@ 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
}
return true
}

// ExpandPath replaces '~' shorthand with the user's home directory.
func ExpandPath(path string) (string, error) {
// Check if path is empty
if path != "" {
Expand Down

0 comments on commit f484524

Please sign in to comment.