Skip to content

Commit 09fcf8e

Browse files
committed
cli/command: NewDockerCli: don't depend on DockerCli.Apply
The Apply method was added when CLI options for constructing the CLI were rewritten into functional options in [cli@7f207f3]. There was no mention in the pull request of this method specifically, and this may have been related to work being done elsewhere on compose-on-kubernetes or the compose-cli plugin that may have needed options to modify the CLI config after it was already initialized. We should try to remove functions that mutate the CLI configuration after initialization if possible (and likely remove the `Apply` method); currently this function is used in docker compose, but as part of a hack that can probably be avoided. [cli@7f207f3]: 7f207f3 Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 133279f) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 56f7bd0 commit 09fcf8e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cli/command/cli.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,10 @@ func NewDockerCli(ops ...CLIOption) (*DockerCli, error) {
603603
ops = append(defaultOps, ops...)
604604

605605
cli := &DockerCli{baseCtx: context.Background()}
606-
if err := cli.Apply(ops...); err != nil {
607-
return nil, err
606+
for _, op := range ops {
607+
if err := op(cli); err != nil {
608+
return nil, err
609+
}
608610
}
609611
return cli, nil
610612
}

0 commit comments

Comments
 (0)