From 78b91ad3ceab3226bad4a067319bd78ff31b987b Mon Sep 17 00:00:00 2001 From: Shaun Date: Thu, 16 Nov 2023 03:31:29 +0000 Subject: [PATCH] fix: ignore unexported fields --- ecp.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ecp.go b/ecp.go index 22d4c9a..b4427f5 100644 --- a/ecp.go +++ b/ecp.go @@ -58,6 +58,9 @@ func (e *ecp) List(config interface{}, prefix ...string) []string { configValue := toValue(config) configType := configValue.Type() for index := 0; index < configValue.NumField(); index++ { + if !configType.Field(index).IsExported() { + continue + } all := e.getAll(getAllOpt{configType, configValue, index, parentName}) if all.parent == "-" || all.key == "" { continue