MCPcopy
hub / github.com/grpc/grpc-go / SetEnvConfig

Function SetEnvConfig

internal/testutils/envconfig.go:26–33  ·  view source on GitHub ↗

SetEnvConfig sets the value of the given variable to the specified value, taking care of restoring the original value after the test completes.

(t *testing.T, variable *T, value T)

Source from the content-addressed store, hash-verified

24// SetEnvConfig sets the value of the given variable to the specified value,
25// taking care of restoring the original value after the test completes.
26func SetEnvConfig[T any](t *testing.T, variable *T, value T) {
27 t.Helper()
28 old := *variable
29 t.Cleanup(func() {
30 *variable = old
31 })
32 *variable = value
33}

Calls

no outgoing calls