handle empty string slice parameter

This commit is contained in:
Timon Ringwald 2022-08-15 14:06:10 +02:00
parent a21ea77bcb
commit 45660f4ff6

View File

@ -7,7 +7,7 @@ import (
)
func StringSlice(key, sep string) []string {
if v, ok := os.LookupEnv(key); ok {
if v, ok := os.LookupEnv(key); ok && strings.TrimSpace(v) != "" {
return strings.Split(v, sep)
}
return []string{}