Skip to content

Commit ff4697d

Browse files
authored
Merge pull request docker#5729 from thaJeztah/cleanup_plugin_install
cli/command/plugin: runCreate: minor cleanup
2 parents 557afb6 + bf2dae2 commit ff4697d

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

cli/command/plugin/create.go

+5-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"io"
87
"os"
98
"path/filepath"
109

@@ -35,7 +34,7 @@ func validateConfig(path string) error {
3534

3635
m := types.PluginConfig{}
3736
err = json.NewDecoder(dt).Decode(&m)
38-
dt.Close()
37+
_ = dt.Close()
3938

4039
return err
4140
}
@@ -87,11 +86,6 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
8786
}
8887

8988
func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateOptions) error {
90-
var (
91-
createCtx io.ReadCloser
92-
err error
93-
)
94-
9589
if err := validateTag(options.repoName); err != nil {
9690
return err
9791
}
@@ -111,17 +105,17 @@ func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateO
111105
compression = archive.Gzip
112106
}
113107

114-
createCtx, err = archive.TarWithOptions(absContextDir, &archive.TarOptions{
108+
createCtx, err := archive.TarWithOptions(absContextDir, &archive.TarOptions{
115109
Compression: compression,
116110
})
117111
if err != nil {
118112
return err
119113
}
120114

121-
createOptions := types.PluginCreateOptions{RepoName: options.repoName}
122-
if err = dockerCli.Client().PluginCreate(ctx, createCtx, createOptions); err != nil {
115+
err = dockerCli.Client().PluginCreate(ctx, createCtx, types.PluginCreateOptions{RepoName: options.repoName})
116+
if err != nil {
123117
return err
124118
}
125-
fmt.Fprintln(dockerCli.Out(), options.repoName)
119+
_, _ = fmt.Fprintln(dockerCli.Out(), options.repoName)
126120
return nil
127121
}

0 commit comments

Comments
 (0)