(env []string)
| 116 | } |
| 117 | |
| 118 | func buildEnvironment(env []string) (map[string]string, error) { |
| 119 | result := make(map[string]string, len(env)) |
| 120 | for _, s := range env { |
| 121 | if runtime.GOOS == "windows" && len(s) > 0 { |
| 122 | // cmd.exe can have special environment variables which names start with "=". |
| 123 | // They are only there for MS-DOS compatibility and we should ignore them. |
| 124 | // See TestBuildEnvironment for examples. |
| 125 | // |
| 126 | // https://ss64.com/nt/syntax-variables.html |
| 127 | // https://devblogs.microsoft.com/oldnewthing/20100506-00/?p=14133 |
| 128 | // https://github.com/docker/cli/issues/4078 |
| 129 | if s[0] == '=' { |
| 130 | continue |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | k, v, ok := strings.Cut(s, "=") |
| 135 | if !ok || k == "" { |
| 136 | return result, fmt.Errorf("unexpected environment variable '%s'", s) |
| 137 | } |
| 138 | // value may be set, but empty if "s" is like "K=", not "K". |
| 139 | result[k] = v |
| 140 | } |
| 141 | return result, nil |
| 142 | } |
| 143 | |
| 144 | func loadConfigFiles(filenames []string, stdin io.Reader) ([]composetypes.ConfigFile, error) { |
| 145 | configFiles := make([]composetypes.ConfigFile, 0, len(filenames)) |
no outgoing calls
searching dependent graphs…