diff --git a/src/go/cmd/update-collection-v3/README.md b/src/go/cmd/update-collection-v3/README.md index 3f317c5e..a1ed014e 100644 --- a/src/go/cmd/update-collection-v3/README.md +++ b/src/go/cmd/update-collection-v3/README.md @@ -48,7 +48,7 @@ make build ## Known issues 1. This package is using github.com/go-yaml/yaml which unfortunately doesn't allow - to maintain `yaml` comments and order when using user defined structutres. + to maintain `yaml` comments and order when using user defined structures. This could be done when we'd use [`yaml.Node`][yaml_node] instead of customized structs which reflect the schema of `values.yaml` used in `sumologic-kubernetes-collection` diff --git a/src/go/cmd/update-collection-v3/main.go b/src/go/cmd/update-collection-v3/main.go index d942e5a6..b3894c94 100644 --- a/src/go/cmd/update-collection-v3/main.go +++ b/src/go/cmd/update-collection-v3/main.go @@ -181,7 +181,7 @@ func reorderYaml(input string, original string) (string, error) { sortByBlueprint(outputMapSlice, originalMapSlice) - outputBytes, err := yaml.MarshalWithOptions(outputMapSlice, yaml.Indent(2)) + outputBytes, err := yaml.MarshalWithOptions(outputMapSlice, yaml.Indent(2), yaml.UseLiteralStyleIfMultiline(true)) return string(outputBytes), err } diff --git a/src/go/cmd/update-collection-v3/testdata/containerd-multiline.input.yaml b/src/go/cmd/update-collection-v3/testdata/containerd-multiline.input.yaml new file mode 100644 index 00000000..1371ea12 --- /dev/null +++ b/src/go/cmd/update-collection-v3/testdata/containerd-multiline.input.yaml @@ -0,0 +1,170 @@ +sumologic: + accessId: xxx + accessKey: yyy + clusterName: containerd-multiline + +fluent-bit: + config: + customParsers: | + [PARSER] + Name containerd_multiline_pattern + Format regex + Regex (?