From e87fc3b863507baca2154c1d981560684984e11f Mon Sep 17 00:00:00 2001 From: Alexey Aksenov Date: Sun, 5 Jun 2022 20:44:51 +0400 Subject: [PATCH] Skip empty value assignment --- cleanenv.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cleanenv.go b/cleanenv.go index 3b03d74..e764551 100644 --- a/cleanenv.go +++ b/cleanenv.go @@ -321,7 +321,9 @@ func readEnvVars(cfg interface{}, update bool) error { for _, env := range meta.envList { if value, ok := os.LookupEnv(env); ok { - rawValue = &value + if len(strings.TrimSpace(value)) > 0 { + rawValue = &value + } break } }