From 3349982312204d6f8440d10709759a65eee4f191 Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Sun, 26 Jun 2022 20:18:12 +0800 Subject: [PATCH] fix(driver): additional items --- internal/operations/driver.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/operations/driver.go b/internal/operations/driver.go index 84bdca7a13e..8bbf9165504 100644 --- a/internal/operations/driver.go +++ b/internal/operations/driver.go @@ -33,6 +33,7 @@ func GetDriverItemsMap() map[string]driver.Items { } func registerDriverItems(config driver.Config, addition driver.Additional) { + log.Debugf("addition of %s: %+v", config.Name, addition) tAddition := reflect.TypeOf(addition) mainItems := getMainItems(config) additionalItems := getAdditionalItems(tAddition) @@ -93,9 +94,13 @@ func getAdditionalItems(t reflect.Type) []driver.Item { var items []driver.Item for i := 0; i < t.NumField(); i++ { field := t.Field(i) + if field.Type.Kind() == reflect.Struct { + items = append(items, getAdditionalItems(field.Type)...) + continue + } tag := field.Tag ignore, ok := tag.Lookup("ignore") - if !ok || ignore == "false" { + if ok && ignore == "true" { continue } item := driver.Item{