Skip to content

Commit

Permalink
refactor: YAMLWithComments indent for array
Browse files Browse the repository at this point in the history
  • Loading branch information
hui.wang committed Feb 21, 2022
1 parent 2158afc commit 01f4d0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xutil/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit 01f4d0e

Please sign in to comment.