fix: defers after checking for err
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
542e9eea5c
commit
7835c1f91d
@ -111,10 +111,10 @@ var appCpCommand = &cli.Command{
|
||||
}
|
||||
} else {
|
||||
content, _, err := cl.CopyFromContainer(ctx, container.ID, srcPath)
|
||||
defer content.Close()
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
defer content.Close()
|
||||
fromTarOpts := &archive.TarOptions{NoOverwriteDirNonDir: true, Compression: archive.Gzip}
|
||||
if err := archive.Untar(content, dstPath, fromTarOpts); err != nil {
|
||||
logrus.Fatal(err)
|
||||
|
@ -42,6 +42,10 @@ func stackLogs(stackName string, client *dockerClient.Client) {
|
||||
Timestamps: true,
|
||||
}
|
||||
logs, err := client.ServiceLogs(ctx, s, logOpts)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
// defer after err check as any err returns a nil io.ReadCloser
|
||||
defer logs.Close()
|
||||
|
||||
_, err = io.Copy(os.Stdout, logs)
|
||||
@ -107,6 +111,10 @@ var appLogsCommand = &cli.Command{
|
||||
Timestamps: true,
|
||||
}
|
||||
logs, err := cl.ServiceLogs(ctx, services[0].ID, logOpts)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
// defer after err check as any err returns a nil io.ReadCloser
|
||||
defer logs.Close()
|
||||
|
||||
_, err = io.Copy(os.Stdout, logs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user