Skip to content

Commit

Permalink
Merge pull request #5729 from thaJeztah/cleanup_plugin_install
Browse files Browse the repository at this point in the history
cli/command/plugin: runCreate: minor cleanup
  • Loading branch information
thaJeztah authored Jan 8, 2025
2 parents 557afb6 + bf2dae2 commit ff4697d
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions cli/command/plugin/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"

Expand Down Expand Up @@ -35,7 +34,7 @@ func validateConfig(path string) error {

m := types.PluginConfig{}
err = json.NewDecoder(dt).Decode(&m)
dt.Close()
_ = dt.Close()

return err
}
Expand Down Expand Up @@ -87,11 +86,6 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
}

func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateOptions) error {
var (
createCtx io.ReadCloser
err error
)

if err := validateTag(options.repoName); err != nil {
return err
}
Expand All @@ -111,17 +105,17 @@ func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateO
compression = archive.Gzip
}

createCtx, err = archive.TarWithOptions(absContextDir, &archive.TarOptions{
createCtx, err := archive.TarWithOptions(absContextDir, &archive.TarOptions{
Compression: compression,
})
if err != nil {
return err
}

createOptions := types.PluginCreateOptions{RepoName: options.repoName}
if err = dockerCli.Client().PluginCreate(ctx, createCtx, createOptions); err != nil {
err = dockerCli.Client().PluginCreate(ctx, createCtx, types.PluginCreateOptions{RepoName: options.repoName})
if err != nil {
return err
}
fmt.Fprintln(dockerCli.Out(), options.repoName)
_, _ = fmt.Fprintln(dockerCli.Out(), options.repoName)
return nil
}

0 comments on commit ff4697d

Please sign in to comment.