handle empty string slice parameter
This commit is contained in:
parent
a21ea77bcb
commit
45660f4ff6
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func StringSlice(key, sep string) []string {
|
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 strings.Split(v, sep)
|
||||||
}
|
}
|
||||||
return []string{}
|
return []string{}
|
||||||
|
Loading…
Reference in New Issue
Block a user