From 1068c188333cff3b6daf2d233301de86ca021987 Mon Sep 17 00:00:00 2001 From: jakezhu9 Date: Fri, 8 Dec 2023 10:09:22 +0000 Subject: [PATCH] fix: line break for windows Signed-off-by: jakezhu9 --- pkg/tools/gen/genkcl_yaml.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/tools/gen/genkcl_yaml.go b/pkg/tools/gen/genkcl_yaml.go index 60ecdaa4..737d3219 100644 --- a/pkg/tools/gen/genkcl_yaml.go +++ b/pkg/tools/gen/genkcl_yaml.go @@ -1,8 +1,10 @@ package gen import ( - "github.com/goccy/go-yaml" + "bytes" "io" + + "github.com/goccy/go-yaml" ) func (k *kclGenerator) genKclFromYaml(w io.Writer, filename string, src interface{}) error { @@ -11,6 +13,8 @@ func (k *kclGenerator) genKclFromYaml(w io.Writer, filename string, src interfac return err } + code = bytes.ReplaceAll(code, []byte("\r\n"), []byte("\n")) + yamlData := &yaml.MapSlice{} if err = yaml.UnmarshalWithOptions(code, yamlData, yaml.UseOrderedMap()); err != nil { return err