Skip to content

Commit a1b01fb

Browse files
author
Aliwoto
committed
Fix parsing slice values in config parser overrides the section value wrongly.
Signed-off-by: Aliwoto <[email protected]>
1 parent 933a6eb commit a1b01fb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ssg/strongParser/helpers.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,13 @@ func parseFinalConfig(v any, section string, configValue *ConfigParser) error {
355355
}
356356

357357
myKind := getArrayKind(fByName.Type)
358-
if section == "" {
359-
section = fByName.Tag.Get("section")
358+
currentSection := section
359+
if currentSection == "" {
360+
currentSection = fByName.Tag.Get("section")
360361
}
361362

362-
if section == "" {
363-
section = configValue.options.MainSectionName
363+
if currentSection == "" {
364+
currentSection = configValue.options.MainSectionName
364365
}
365366

366367
key := fByName.Tag.Get("key")
@@ -373,7 +374,7 @@ func parseFinalConfig(v any, section string, configValue *ConfigParser) error {
373374
isRune := fType == "rune" || fType == "[]rune"
374375

375376
valueToSet, err := configValue.getArrayValueToSet(
376-
section, key, envKey,
377+
currentSection, key, envKey,
377378
myKind, isRune,
378379
)
379380
if err != nil || valueToSet.IsNil() || !valueToSet.IsValid() {

0 commit comments

Comments
 (0)