Procházet zdrojové kódy

cmd/compose: fix minor linting issues

- inline variable that shadowed package-type
- don't use apiBuildOptions if an error was returned

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Sebastiaan van Stijn před 2 měsíci
rodič
revize
4a4776ec57
2 změnil soubory, kde provedl 3 přidání a 5 odebrání
  1. 1 1
      cmd/compose/build.go
  2. 2 4
      cmd/compose/commit.go

+ 1 - 1
cmd/compose/build.go

@@ -160,10 +160,10 @@ func runBuild(ctx context.Context, dockerCli command.Cli, backend api.Service, o
 	}
 
 	apiBuildOptions, err := opts.toAPIBuildOptions(services)
-	apiBuildOptions.Attestations = true
 	if err != nil {
 		return err
 	}
+	apiBuildOptions.Attestations = true
 
 	return backend.Build(ctx, project, apiBuildOptions)
 }

+ 2 - 4
cmd/compose/commit.go

@@ -79,7 +79,7 @@ func runCommit(ctx context.Context, dockerCli command.Cli, backend api.Service,
 		return err
 	}
 
-	commitOptions := api.CommitOptions{
+	return backend.Commit(ctx, projectName, api.CommitOptions{
 		Service:   options.service,
 		Reference: options.reference,
 		Pause:     options.pause,
@@ -87,7 +87,5 @@ func runCommit(ctx context.Context, dockerCli command.Cli, backend api.Service,
 		Author:    options.author,
 		Changes:   options.changes,
 		Index:     options.index,
-	}
-
-	return backend.Commit(ctx, projectName, commitOptions)
+	})
 }