2022-01-06 06:40:23 -05:00
|
|
|
package env
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func unsetEnvKeys(envKeys []string, err error) (newErr error) {
|
|
|
|
|
newErr = err
|
|
|
|
|
for _, envKey := range envKeys {
|
|
|
|
|
unsetErr := os.Unsetenv(envKey)
|
|
|
|
|
if unsetErr != nil && newErr == nil {
|
2023-04-01 16:53:04 +00:00
|
|
|
newErr = fmt.Errorf("unsetting environment variable %s: %w", envKey, unsetErr)
|
2022-01-06 06:40:23 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return newErr
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-30 13:02:10 +00:00
|
|
|
func ptrTo[T any](value T) *T {
|
|
|
|
|
return &value
|
|
|
|
|
}
|