From 44a4307c3abcb17e11b1a895a0e83abf26ac7621 Mon Sep 17 00:00:00 2001 From: Suleiman Dibirov Date: Sat, 1 Feb 2025 20:33:54 +0200 Subject: [PATCH] fix: Revert user-agent for docker cli client Signed-off-by: Suleiman Dibirov --- cmd/main.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 58370270868..386f5b1b6d6 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -24,7 +24,6 @@ import ( "github.com/docker/cli/cli-plugins/plugin" "github.com/docker/cli/cli/command" "github.com/docker/compose/v2/cmd/cmdtrace" - "github.com/docker/docker/client" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -47,8 +46,6 @@ func pluginMain() { if err := plugin.PersistentPreRunE(cmd, args); err != nil { return err } - // compose-specific initialization - dockerCliPostInitialize(dockerCli) if err := cmdtrace.Setup(cmd, dockerCli, os.Args[1:]); err != nil { logrus.Debugf("failed to enable tracing: %v", err) @@ -75,22 +72,6 @@ func pluginMain() { }) } -// dockerCliPostInitialize performs Compose-specific configuration for the -// command.Cli instance provided by the plugin.Run() initialization. -// -// NOTE: This must be called AFTER plugin.PersistentPreRunE. -func dockerCliPostInitialize(dockerCli command.Cli) { - // HACK(milas): remove once docker/cli#4574 is merged; for now, - // set it in a rather roundabout way by grabbing the underlying - // concrete client and manually invoking an option on it - _ = dockerCli.Apply(func(cli *command.DockerCli) error { - if mobyClient, ok := cli.Client().(*client.Client); ok { - _ = client.WithUserAgent("compose/" + internal.Version)(mobyClient) - } - return nil - }) -} - func main() { if plugin.RunningStandalone() { os.Args = append([]string{"docker"}, compatibility.Convert(os.Args[1:])...)