diff --git a/cli/command/context/show.go b/cli/command/context/show.go index 0bcdfabee16b..dd33f9e02a84 100644 --- a/cli/command/context/show.go +++ b/cli/command/context/show.go @@ -16,19 +16,14 @@ func newShowCommand(dockerCli command.Cli) *cobra.Command { Short: "Print the name of the current context", Args: cli.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { - return runShow(dockerCli) + runShow(dockerCli) + return nil }, ValidArgsFunction: completion.NoComplete, } return cmd } -func runShow(dockerCli command.Cli) error { - context := dockerCli.CurrentContext() - metadata, err := dockerCli.ContextStore().GetMetadata(context) - if err != nil { - return err - } - fmt.Fprintln(dockerCli.Out(), metadata.Name) - return nil +func runShow(dockerCli command.Cli) { + fmt.Fprintln(dockerCli.Out(), dockerCli.CurrentContext()) } diff --git a/cli/command/context/show_test.go b/cli/command/context/show_test.go index 08bedee69bcc..40ac58ad0575 100644 --- a/cli/command/context/show_test.go +++ b/cli/command/context/show_test.go @@ -3,7 +3,6 @@ package context import ( "testing" - "gotest.tools/v3/assert" "gotest.tools/v3/golden" ) @@ -13,6 +12,6 @@ func TestShow(t *testing.T) { cli.SetCurrentContext("current") cli.OutBuffer().Reset() - assert.NilError(t, runShow(cli)) + runShow(cli) golden.Assert(t, cli.OutBuffer().String(), "show.golden") }