From 01f4d0e30a5854eda00d4b73c869057309ea58c5 Mon Sep 17 00:00:00 2001 From: "hui.wang" Date: Mon, 21 Feb 2022 17:22:56 +0800 Subject: [PATCH] refactor: YAMLWithComments indent for array --- xutil/marshal.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xutil/marshal.go b/xutil/marshal.go index 128479b..093dabc 100644 --- a/xutil/marshal.go +++ b/xutil/marshal.go @@ -8,7 +8,7 @@ import ( ) const ( - indentation = 2 + indentation = 4 ) func YAMLWithComments(data interface{}, atIndent int, yamlTag string, usageTag string, yamlKey func(string) string) (string, error) { @@ -35,7 +35,7 @@ func YAMLWithComments(data interface{}, atIndent int, yamlTag string, usageTag s } else { result = fmt.Sprintf("%s %s\n", result, comment) for i := 0; i < value.Len(); i++ { - result = fmt.Sprintf("%s%s-", result, indent) + result = fmt.Sprintf("%s%s -", result, indent) nested, err := YAMLWithComments(value.Index(i).Interface(), atIndent+indentation, yamlTag, usageTag, yamlKey) if err != nil { return err