configstruct: skip items with config:"-"

This commit is contained in:
Nick Craig-Wood 2024-07-08 16:20:33 +01:00
parent 3280b6b83c
commit 7c51b10d15

View file

@ -116,6 +116,10 @@ func Items(opt interface{}) (items []Item, err error) {
fieldType := defType.Field(i) fieldType := defType.Field(i)
fieldName := fieldType.Name fieldName := fieldType.Name
configName, hasTag := fieldType.Tag.Lookup("config") configName, hasTag := fieldType.Tag.Lookup("config")
if hasTag && configName == "-" {
// Skip items with config:"-"
continue
}
if !hasTag { if !hasTag {
configName = camelToSnake(fieldName) configName = camelToSnake(fieldName)
} }