1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00

cli/command/manifest: minor cleanups: use Println, rename vars

- use Println to print newline instead of custom format
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-02-01 22:38:48 +01:00
parent c8f27b027f
commit 5d3bdf8ac2
2 changed files with 9 additions and 9 deletions

View File

@@ -35,7 +35,7 @@ func newCreateListCommand(dockerCli command.Cli) *cobra.Command {
return cmd
}
func createManifestList(ctx context.Context, dockerCli command.Cli, args []string, opts createOpts) error {
func createManifestList(ctx context.Context, dockerCLI command.Cli, args []string, opts createOpts) error {
newRef := args[0]
targetRef, err := normalizeReference(newRef)
if err != nil {
@@ -47,7 +47,7 @@ func createManifestList(ctx context.Context, dockerCli command.Cli, args []strin
return errors.Wrapf(err, "error parsing repository name for manifest list %s", newRef)
}
manifestStore := dockerCli.ManifestStore()
manifestStore := dockerCLI.ManifestStore()
_, err = manifestStore.GetList(targetRef)
switch {
case store.IsNotFound(err):
@@ -68,7 +68,7 @@ func createManifestList(ctx context.Context, dockerCli command.Cli, args []strin
return err
}
manifest, err := getManifest(ctx, dockerCli, targetRef, namedRef, opts.insecure)
manifest, err := getManifest(ctx, dockerCLI, targetRef, namedRef, opts.insecure)
if err != nil {
return err
}
@@ -76,6 +76,6 @@ func createManifestList(ctx context.Context, dockerCli command.Cli, args []strin
return err
}
}
fmt.Fprintf(dockerCli.Out(), "Created manifest list %s\n", targetRef.String())
_, _ = fmt.Fprintln(dockerCLI.Out(), "Created manifest list", targetRef.String())
return nil
}

View File

@@ -268,13 +268,13 @@ func buildPutManifestRequest(imageManifest types.ImageManifest, targetRef refere
return mountRequest{ref: mountRef, manifest: imageManifest}, err
}
func pushList(ctx context.Context, dockerCli command.Cli, req pushRequest) error {
rclient := dockerCli.RegistryClient(req.insecure)
func pushList(ctx context.Context, dockerCLI command.Cli, req pushRequest) error {
rclient := dockerCLI.RegistryClient(req.insecure)
if err := mountBlobs(ctx, rclient, req.targetRef, req.manifestBlobs); err != nil {
return err
}
if err := pushReferences(ctx, dockerCli.Out(), rclient, req.mountRequests); err != nil {
if err := pushReferences(ctx, dockerCLI.Out(), rclient, req.mountRequests); err != nil {
return err
}
dgst, err := rclient.PutManifest(ctx, req.targetRef, req.list)
@@ -282,7 +282,7 @@ func pushList(ctx context.Context, dockerCli command.Cli, req pushRequest) error
return err
}
fmt.Fprintln(dockerCli.Out(), dgst.String())
_, _ = fmt.Fprintln(dockerCLI.Out(), dgst.String())
return nil
}
@@ -292,7 +292,7 @@ func pushReferences(ctx context.Context, out io.Writer, client registryclient.Re
if err != nil {
return err
}
fmt.Fprintf(out, "Pushed ref %s with digest: %s\n", mount.ref, newDigest)
_, _ = fmt.Fprintf(out, "Pushed ref %s with digest: %s\n", mount.ref, newDigest)
}
return nil
}