Skip to content

Commit 133279f

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]>
1 parent e241f53 commit 133279f

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
@@ -602,8 +602,10 @@ func NewDockerCli(ops ...CLIOption) (*DockerCli, error) {
602602
ops = append(defaultOps, ops...)
603603

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

0 commit comments

Comments
 (0)