Skip to content

Commit 56dc0a0

Browse files
authored
Address some linting problems (#34)
1 parent c00f6f7 commit 56dc0a0

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

cmd/deploy.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,7 @@ If deployment failed, then rolls back to the previous stack definition.`,
5555
func init() {
5656
rootCmd.AddCommand(deployCmd)
5757
deployCmd.PersistentFlags().StringSliceP("service", "s", []string{}, "Names of services to update. Can be specified multiple times for parallel deployment")
58-
viper.BindPFlag("deploy.services", deployCmd.PersistentFlags().Lookup("service"))
58+
if err := viper.BindPFlag("deploy.services", deployCmd.PersistentFlags().Lookup("service")); err != nil {
59+
log.WithError(err).Fatal("can't bind flag to config")
60+
}
5961
}

lib/ssh.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,5 @@ func ConnectSSH(profile, cluster, taskDefinitionName, containerName, shell, serv
132132

133133
env := os.Environ()
134134

135-
syscall.Exec("/usr/bin/ssh", params, env)
136-
137-
return 0, nil
135+
return 0, syscall.Exec("/usr/bin/ssh", params, env)
138136
}

lib/ssm.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ func runProcessor(value string, command []string) (string, error) {
6464
}
6565
go func() {
6666
defer stdin.Close()
67-
io.WriteString(stdin, value)
67+
if _, err := io.WriteString(stdin, value); err != nil {
68+
log.WithError(err).Error("can't write to stdin of the command")
69+
}
6870
}()
6971

7072
stdout, err := cmd.StdoutPipe()
@@ -73,7 +75,9 @@ func runProcessor(value string, command []string) (string, error) {
7375
}
7476
go func() {
7577
defer stdout.Close()
76-
io.Copy(output, stdout)
78+
if _, err := io.Copy(output, stdout); err != nil {
79+
log.WithError(err).Error("can't write the command's stdout to output")
80+
}
7781
}()
7882

7983
stderr, err := cmd.StderrPipe()
@@ -82,7 +86,9 @@ func runProcessor(value string, command []string) (string, error) {
8286
}
8387
go func() {
8488
defer stderr.Close()
85-
io.Copy(os.Stderr, stderr)
89+
if _, err := io.Copy(os.Stderr, stderr); err != nil {
90+
log.WithError(err).Error("can't write the command's stderr to stderr")
91+
}
8692
}()
8793

8894
if err := cmd.Start(); err != nil {

0 commit comments

Comments
 (0)