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
8988func 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