getEnvValue looks up a key in an environment slice ([]string of "KEY=VALUE"). Returns the value if found, or empty string otherwise.
(env []string, key string)
| 269 | // getEnvValue looks up a key in an environment slice ([]string of "KEY=VALUE"). |
| 270 | // Returns the value if found, or empty string otherwise. |
| 271 | func getEnvValue(env []string, key string) string { |
| 272 | prefix := key + "=" |
| 273 | for i := len(env) - 1; i >= 0; i-- { |
| 274 | if strings.HasPrefix(env[i], prefix) { |
| 275 | return env[i][len(prefix):] |
| 276 | } |
| 277 | } |
| 278 | return "" |
| 279 | } |
| 280 | |
| 281 | // setEnvValue returns a copy of env with all existing entries for key removed and |
| 282 | // a single trailing KEY=VALUE entry added so SDK-managed values win deterministically. |
no outgoing calls
no test coverage detected
searching dependent graphs…