Skip to content

Commit 879acd1

Browse files
authored
Merge pull request #5911 from thaJeztah/builder_nits
cli/command/image: fix some minor linting issues
2 parents a07391c + 2c0f9f4 commit 879acd1

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

cli/command/image/build.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
242242

243243
if err != nil {
244244
if options.quiet && urlutil.IsURL(specifiedContext) {
245-
fmt.Fprintln(dockerCli.Err(), progBuff)
245+
_, _ = fmt.Fprintln(dockerCli.Err(), progBuff)
246246
}
247247
return errors.Errorf("unable to prepare context: %s", err)
248248
}
@@ -337,16 +337,16 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
337337
for k, auth := range creds {
338338
authConfigs[k] = registrytypes.AuthConfig(auth)
339339
}
340-
buildOptions := imageBuildOptions(dockerCli, options)
341-
buildOptions.Version = types.BuilderV1
342-
buildOptions.Dockerfile = relDockerfile
343-
buildOptions.AuthConfigs = authConfigs
344-
buildOptions.RemoteContext = remote
340+
buildOpts := imageBuildOptions(dockerCli, options)
341+
buildOpts.Version = types.BuilderV1
342+
buildOpts.Dockerfile = relDockerfile
343+
buildOpts.AuthConfigs = authConfigs
344+
buildOpts.RemoteContext = remote
345345

346-
response, err := dockerCli.Client().ImageBuild(ctx, body, buildOptions)
346+
response, err := dockerCli.Client().ImageBuild(ctx, body, buildOpts)
347347
if err != nil {
348348
if options.quiet {
349-
fmt.Fprintf(dockerCli.Err(), "%s", progBuff)
349+
_, _ = fmt.Fprintf(dockerCli.Err(), "%s", progBuff)
350350
}
351351
cancel()
352352
return err
@@ -357,7 +357,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
357357
aux := func(msg jsonstream.JSONMessage) {
358358
var result types.BuildResult
359359
if err := json.Unmarshal(*msg.Aux, &result); err != nil {
360-
fmt.Fprintf(dockerCli.Err(), "Failed to parse aux message: %s", err)
360+
_, _ = fmt.Fprintf(dockerCli.Err(), "Failed to parse aux message: %s", err)
361361
} else {
362362
imageID = result.ID
363363
}
@@ -371,7 +371,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
371371
jerr.Code = 1
372372
}
373373
if options.quiet {
374-
fmt.Fprintf(dockerCli.Err(), "%s%s", progBuff, buildBuff)
374+
_, _ = fmt.Fprintf(dockerCli.Err(), "%s%s", progBuff, buildBuff)
375375
}
376376
return cli.StatusError{Status: jerr.Message, StatusCode: jerr.Code}
377377
}
@@ -381,7 +381,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
381381
// Windows: show error message about modified file permissions if the
382382
// daemon isn't running Windows.
383383
if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet {
384-
fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+
384+
_, _ = fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+
385385
"image from Windows against a non-Windows Docker host. All files and "+
386386
"directories added to build context will have '-rwxr-xr-x' permissions. "+
387387
"It is recommended to double check and reset permissions for sensitive "+
@@ -502,12 +502,12 @@ func replaceDockerfileForContentTrust(ctx context.Context, inputTarStream io.Rea
502502
hdr, err := tarReader.Next()
503503
if err == io.EOF {
504504
// Signals end of archive.
505-
tarWriter.Close()
506-
pipeWriter.Close()
505+
_ = tarWriter.Close()
506+
_ = pipeWriter.Close()
507507
return
508508
}
509509
if err != nil {
510-
pipeWriter.CloseWithError(err)
510+
_ = pipeWriter.CloseWithError(err)
511511
return
512512
}
513513

@@ -519,20 +519,20 @@ func replaceDockerfileForContentTrust(ctx context.Context, inputTarStream io.Rea
519519
var newDockerfile []byte
520520
newDockerfile, *resolvedTags, err = rewriteDockerfileFromForContentTrust(ctx, content, translator)
521521
if err != nil {
522-
pipeWriter.CloseWithError(err)
522+
_ = pipeWriter.CloseWithError(err)
523523
return
524524
}
525525
hdr.Size = int64(len(newDockerfile))
526526
content = bytes.NewBuffer(newDockerfile)
527527
}
528528

529529
if err := tarWriter.WriteHeader(hdr); err != nil {
530-
pipeWriter.CloseWithError(err)
530+
_ = pipeWriter.CloseWithError(err)
531531
return
532532
}
533533

534534
if _, err := io.Copy(tarWriter, content); err != nil {
535-
pipeWriter.CloseWithError(err)
535+
_ = pipeWriter.CloseWithError(err)
536536
return
537537
}
538538
}

0 commit comments

Comments
 (0)