Skip to content

Commit 5d3bdf8

Browse files
committed
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>
1 parent c8f27b0 commit 5d3bdf8

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

cli/command/manifest/create_list.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func newCreateListCommand(dockerCli command.Cli) *cobra.Command {
3535
return cmd
3636
}
3737

38-
func createManifestList(ctx context.Context, dockerCli command.Cli, args []string, opts createOpts) error {
38+
func createManifestList(ctx context.Context, dockerCLI command.Cli, args []string, opts createOpts) error {
3939
newRef := args[0]
4040
targetRef, err := normalizeReference(newRef)
4141
if err != nil {
@@ -47,7 +47,7 @@ func createManifestList(ctx context.Context, dockerCli command.Cli, args []strin
4747
return errors.Wrapf(err, "error parsing repository name for manifest list %s", newRef)
4848
}
4949

50-
manifestStore := dockerCli.ManifestStore()
50+
manifestStore := dockerCLI.ManifestStore()
5151
_, err = manifestStore.GetList(targetRef)
5252
switch {
5353
case store.IsNotFound(err):
@@ -68,14 +68,14 @@ func createManifestList(ctx context.Context, dockerCli command.Cli, args []strin
6868
return err
6969
}
7070

71-
manifest, err := getManifest(ctx, dockerCli, targetRef, namedRef, opts.insecure)
71+
manifest, err := getManifest(ctx, dockerCLI, targetRef, namedRef, opts.insecure)
7272
if err != nil {
7373
return err
7474
}
7575
if err := manifestStore.Save(targetRef, namedRef, manifest); err != nil {
7676
return err
7777
}
7878
}
79-
fmt.Fprintf(dockerCli.Out(), "Created manifest list %s\n", targetRef.String())
79+
_, _ = fmt.Fprintln(dockerCLI.Out(), "Created manifest list", targetRef.String())
8080
return nil
8181
}

cli/command/manifest/push.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,21 +268,21 @@ func buildPutManifestRequest(imageManifest types.ImageManifest, targetRef refere
268268
return mountRequest{ref: mountRef, manifest: imageManifest}, err
269269
}
270270

271-
func pushList(ctx context.Context, dockerCli command.Cli, req pushRequest) error {
272-
rclient := dockerCli.RegistryClient(req.insecure)
271+
func pushList(ctx context.Context, dockerCLI command.Cli, req pushRequest) error {
272+
rclient := dockerCLI.RegistryClient(req.insecure)
273273

274274
if err := mountBlobs(ctx, rclient, req.targetRef, req.manifestBlobs); err != nil {
275275
return err
276276
}
277-
if err := pushReferences(ctx, dockerCli.Out(), rclient, req.mountRequests); err != nil {
277+
if err := pushReferences(ctx, dockerCLI.Out(), rclient, req.mountRequests); err != nil {
278278
return err
279279
}
280280
dgst, err := rclient.PutManifest(ctx, req.targetRef, req.list)
281281
if err != nil {
282282
return err
283283
}
284284

285-
fmt.Fprintln(dockerCli.Out(), dgst.String())
285+
_, _ = fmt.Fprintln(dockerCLI.Out(), dgst.String())
286286
return nil
287287
}
288288

@@ -292,7 +292,7 @@ func pushReferences(ctx context.Context, out io.Writer, client registryclient.Re
292292
if err != nil {
293293
return err
294294
}
295-
fmt.Fprintf(out, "Pushed ref %s with digest: %s\n", mount.ref, newDigest)
295+
_, _ = fmt.Fprintf(out, "Pushed ref %s with digest: %s\n", mount.ref, newDigest)
296296
}
297297
return nil
298298
}

0 commit comments

Comments
 (0)