From 906db9c3a4217d2c826372be478ab5e50617ee48 Mon Sep 17 00:00:00 2001 From: zwwhdls Date: Sun, 8 Dec 2019 00:30:16 +0800 Subject: [PATCH] fix #6116 Signed-off-by: zwwhdls --- pkg/strvals/parser.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index c735412e9..3c585cbea 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -305,8 +305,15 @@ func (t *parser) listItem(list []interface{}, i int) ([]interface{}, error) { if err != nil { return list, errors.Wrap(err, "error parsing index") } + var crtList []interface{} + if len(list) > i { + // If nested list already exists, take the value of list to next cycle. + crtList = list[i].([]interface{}) + } else { + crtList = list + } // Now we need to get the value after the ]. - list2, err := t.listItem(list, i) + list2, err := t.listItem(crtList, i) if err != nil { return list, err }