4
4
"context"
5
5
"encoding/json"
6
6
"fmt"
7
- "io"
8
7
"os"
9
8
"path/filepath"
10
9
@@ -35,7 +34,7 @@ func validateConfig(path string) error {
35
34
36
35
m := types.PluginConfig {}
37
36
err = json .NewDecoder (dt ).Decode (& m )
38
- dt .Close ()
37
+ _ = dt .Close ()
39
38
40
39
return err
41
40
}
@@ -87,11 +86,6 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
87
86
}
88
87
89
88
func runCreate (ctx context.Context , dockerCli command.Cli , options pluginCreateOptions ) error {
90
- var (
91
- createCtx io.ReadCloser
92
- err error
93
- )
94
-
95
89
if err := validateTag (options .repoName ); err != nil {
96
90
return err
97
91
}
@@ -111,17 +105,17 @@ func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateO
111
105
compression = archive .Gzip
112
106
}
113
107
114
- createCtx , err = archive .TarWithOptions (absContextDir , & archive.TarOptions {
108
+ createCtx , err : = archive .TarWithOptions (absContextDir , & archive.TarOptions {
115
109
Compression : compression ,
116
110
})
117
111
if err != nil {
118
112
return err
119
113
}
120
114
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 {
123
117
return err
124
118
}
125
- fmt .Fprintln (dockerCli .Out (), options .repoName )
119
+ _ , _ = fmt .Fprintln (dockerCli .Out (), options .repoName )
126
120
return nil
127
121
}
0 commit comments