Ian Howell bba1bd9d3d This is a code-linting refactor
This refactors a large part of the codebase using the suggestions from
golangci-lint

Change-Id: I2b7735086a64e50f3d5e0b30c225870bddc70935
2019-09-30 14:20:43 -05:00

26 lines
476 B
Go

package command
import (
"os"
"os/exec"
"syscall"
"github.com/stackanetes/kubernetes-entrypoint/logger"
)
func Execute(command []string) error {
path, err := exec.LookPath(command[0])
if err != nil {
logger.Error.Printf("Cannot find a binary %v : %v", command[0], err)
return err
}
env := os.Environ()
err = syscall.Exec(path, command, env)
if err != nil {
logger.Error.Printf("Executing command %v failed: %v", command, err)
return err
}
return nil
}