chore: add config parse nil value soluition

This commit is contained in:
langhuihui
2025-03-26 11:01:23 +08:00
parent 7998d55b41
commit cc4ee2a447

View File

@@ -101,6 +101,12 @@ func (config *Config) Parse(s any, prefix ...string) {
}
config.Ptr = v
if v.IsZero() || v.IsNil() {
fmt.Println("parse to ", prefix, config.name, s, "is zero or nil")
return
}
config.Default = v.Interface()
if l := len(prefix); l > 0 { // 读取环境变量