vendor: github.com/docker/cli v23.0.0

full diff: https://github.com/docker/cli/compare/v23.0.0-rc.1...v23.0.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2023-02-08 15:32:57 +01:00
parent 260117289b
commit 081447c9b1
26 changed files with 540 additions and 224 deletions

View File

@@ -16,15 +16,16 @@ import (
//
// The only validation here is to check if name is empty, per #25099
func ValidateEnv(val string) (string, error) {
arr := strings.SplitN(val, "=", 2)
if arr[0] == "" {
k, _, hasValue := strings.Cut(val, "=")
if k == "" {
return "", errors.New("invalid environment variable: " + val)
}
if len(arr) > 1 {
if hasValue {
// val contains a "=" (but value may be an empty string)
return val, nil
}
if envVal, ok := os.LookupEnv(arr[0]); ok {
return arr[0] + "=" + envVal, nil
if envVal, ok := os.LookupEnv(k); ok {
return k + "=" + envVal, nil
}
return val, nil
}