diff --git a/cli/command/cli.go b/cli/command/cli.go index fd08cbeb88..90e9057e6c 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -283,7 +283,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 @@ -479,7 +479,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. // // { @@ -496,7 +496,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 092fcad384..e418a3c76d 100644 --- a/cli/command/cli_test.go +++ b/cli/command/cli_test.go @@ -354,11 +354,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) { @@ -369,7 +369,7 @@ func TestAllowNegativex509(t *testing.T) { }, }, } - setAllowNegativex509(meta) + setGoDebug(meta) assert.Equal(t, "val1,val2=1", os.Getenv("GODEBUG")) }) }