no need to set exec.Env to os.Environ() as it's the default

Per the docs: e73f489494/src/os/exec/exec.go (L57-L60)

> If Env is nil, the new process uses the current process's environment.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-01-12 13:32:23 +01:00
parent ad2765b35e
commit ead47f0a83
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 4 additions and 5 deletions

View File

@ -15,7 +15,6 @@ func system(commands [][]string) error {
cmd := exec.Command(c[0], c[1:]...) cmd := exec.Command(c[0], c[1:]...)
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
cmd.Env = os.Environ()
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
return err return err
} }
@ -23,7 +22,7 @@ func system(commands [][]string) error {
return nil return nil
} }
func pushImage(unusedCli *client.Client, remote, local string) error { func pushImage(_ *client.Client, remote, local string) error {
// FIXME: eliminate os/exec (but it is hard to pass auth without os/exec ...) // FIXME: eliminate os/exec (but it is hard to pass auth without os/exec ...)
return system([][]string{ return system([][]string{
{"docker", "image", "tag", local, remote}, {"docker", "image", "tag", local, remote},
@ -31,7 +30,7 @@ func pushImage(unusedCli *client.Client, remote, local string) error {
}) })
} }
func deployStack(unusedCli *client.Client, stackName, composeFilePath string) error { func deployStack(_ *client.Client, stackName, composeFilePath string) error {
// FIXME: eliminate os/exec (but stack is implemented in CLI ...) // FIXME: eliminate os/exec (but stack is implemented in CLI ...)
return system([][]string{ return system([][]string{
{"docker", "stack", "deploy", {"docker", "stack", "deploy",
@ -41,7 +40,7 @@ func deployStack(unusedCli *client.Client, stackName, composeFilePath string) er
}) })
} }
func hasStack(unusedCli *client.Client, stackName string) bool { func hasStack(_ *client.Client, stackName string) bool {
// FIXME: eliminate os/exec (but stack is implemented in CLI ...) // FIXME: eliminate os/exec (but stack is implemented in CLI ...)
out, err := exec.Command("docker", "stack", "ls").CombinedOutput() out, err := exec.Command("docker", "stack", "ls").CombinedOutput()
if err != nil { if err != nil {
@ -51,7 +50,7 @@ func hasStack(unusedCli *client.Client, stackName string) bool {
return strings.Contains(string(out), stackName) return strings.Contains(string(out), stackName)
} }
func removeStack(unusedCli *client.Client, stackName string) error { func removeStack(_ *client.Client, stackName string) error {
// FIXME: eliminate os/exec (but stack is implemented in CLI ...) // FIXME: eliminate os/exec (but stack is implemented in CLI ...)
if err := system([][]string{ if err := system([][]string{
{"docker", "stack", "rm", stackName}, {"docker", "stack", "rm", stackName},