diff --git a/cli/command/cli.go b/cli/command/cli.go index 61d27e70fd..d11961e61b 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -284,7 +284,7 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...CLIOption) meta, err := cli.contextStore.GetMetadata(cli.currentContext) if err == nil { - setAllowNegativex509(meta) + setGoDebug(meta) } return nil @@ -480,7 +480,7 @@ func (cli *DockerCli) getDockerEndPoint() (ep docker.Endpoint, err error) { return resolveDockerEndpoint(cli.contextStore, cn) } -// setAllowNegativex509 is an escape hatch that sets the GODEBUG environment +// setGoDebug is an escape hatch that sets the GODEBUG environment // variable value using docker context metadata. // // { @@ -497,7 +497,7 @@ func (cli *DockerCli) getDockerEndPoint() (ep docker.Endpoint, err error) { // This option should only be used for legacy compatibility and never in // production environments. // Use at your own risk. -func setAllowNegativex509(meta store.Metadata) { +func setGoDebug(meta store.Metadata) { fieldName := "GODEBUG" godebugEnv := os.Getenv(fieldName) // early return if GODEBUG is already set. We don't want to override what diff --git a/cli/command/cli_test.go b/cli/command/cli_test.go index 338dae34df..cc30aed926 100644 --- a/cli/command/cli_test.go +++ b/cli/command/cli_test.go @@ -355,11 +355,11 @@ func TestHooksEnabled(t *testing.T) { }) } -func TestAllowNegativex509(t *testing.T) { +func TestSetGoDebug(t *testing.T) { t.Run("GODEBUG already set", func(t *testing.T) { t.Setenv("GODEBUG", "val1,val2") meta := store.Metadata{} - setAllowNegativex509(meta) + setGoDebug(meta) assert.Equal(t, "val1,val2", os.Getenv("GODEBUG")) }) t.Run("GODEBUG in context metadata can set env", func(t *testing.T) { @@ -370,7 +370,7 @@ func TestAllowNegativex509(t *testing.T) { }, }, } - setAllowNegativex509(meta) + setGoDebug(meta) assert.Equal(t, "val1,val2=1", os.Getenv("GODEBUG")) }) }