rename function to fit what it is doing

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
(cherry picked from commit 6163c03b11)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Alano Terblanche
2025-08-29 14:08:15 +02:00
committed by Paweł Gronowski
parent 8cfe1f712e
commit 4108febfae
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -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
+3 -3
View File
@@ -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"))
})
}