@@ -184,7 +184,6 @@ func (out *lastProgressOutput) WriteProgress(prog progress.Progress) error {
184184//nolint:gocyclo
185185func runBuild (ctx context.Context , dockerCli command.Cli , options buildOptions ) error {
186186 var (
187- err error
188187 buildCtx io.ReadCloser
189188 dockerfileCtx io.ReadCloser
190189 contextDir string
@@ -266,7 +265,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
266265 }
267266
268267 if err := build .ValidateContextDirectory (contextDir , excludes ); err != nil {
269- return errors .Wrap (err , "error checking context" )
268+ return errors .Wrap (err , "checking context" )
270269 }
271270
272271 // And canonicalize dockerfile name to a platform-independent one
@@ -353,7 +352,6 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
353352 }
354353 }
355354 buildOpts := imageBuildOptions (dockerCli , options )
356- buildOpts .Version = buildtypes .BuilderV1
357355 buildOpts .Dockerfile = relDockerfile
358356 buildOpts .AuthConfigs = authConfigs
359357 buildOpts .RemoteContext = remote
@@ -363,7 +361,6 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
363361 if options .quiet {
364362 _ , _ = fmt .Fprintf (dockerCli .Err (), "%s" , progBuff )
365363 }
366- cancel ()
367364 return err
368365 }
369366 defer response .Body .Close ()
@@ -380,7 +377,8 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
380377
381378 err = jsonstream .Display (ctx , response .Body , streams .NewOut (buildBuff ), jsonstream .WithAuxCallback (aux ))
382379 if err != nil {
383- if jerr , ok := err .(* jsonstream.JSONError ); ok {
380+ var jerr * jsonstream.JSONError
381+ if errors .As (err , & jerr ) {
384382 // If no error code is set, default to 1
385383 if jerr .Code == 0 {
386384 jerr .Code = 1
@@ -544,6 +542,7 @@ func replaceDockerfileForContentTrust(ctx context.Context, inputTarStream io.Rea
544542func imageBuildOptions (dockerCli command.Cli , options buildOptions ) buildtypes.ImageBuildOptions {
545543 configFile := dockerCli .ConfigFile ()
546544 return buildtypes.ImageBuildOptions {
545+ Version : buildtypes .BuilderV1 ,
547546 Memory : options .memory .Value (),
548547 MemorySwap : options .memorySwap .Value (),
549548 Tags : options .tags .GetSlice (),
0 commit comments