From 45660f4ff661b8daeed1a9fc35e797ec0de7bdbd Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Mon, 15 Aug 2022 14:06:10 +0200 Subject: [PATCH] handle empty string slice parameter --- slices.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slices.go b/slices.go index fafda53..eabe60f 100644 --- a/slices.go +++ b/slices.go @@ -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{}