GetTaskEnvStringSlice returns a comma-separated list from a TASK_ prefixed env var. Returns the slice and true if set (non-empty), or nil and false if not set.
(key string)
| 107 | // GetTaskEnvStringSlice returns a comma-separated list from a TASK_ prefixed env var. |
| 108 | // Returns the slice and true if set (non-empty), or nil and false if not set. |
| 109 | func GetTaskEnvStringSlice(key string) ([]string, bool) { |
| 110 | v := GetTaskEnv(key) |
| 111 | if v == "" { |
| 112 | return nil, false |
| 113 | } |
| 114 | parts := strings.Split(v, ",") |
| 115 | result := make([]string, 0, len(parts)) |
| 116 | for _, p := range parts { |
| 117 | if trimmed := strings.TrimSpace(p); trimmed != "" { |
| 118 | result = append(result, trimmed) |
| 119 | } |
| 120 | } |
| 121 | if len(result) == 0 { |
| 122 | return nil, false |
| 123 | } |
| 124 | return result, true |
| 125 | } |
no test coverage detected
searching dependent graphs…