Skip to content

Commit

Permalink
Fix csv-generator's invalid YAML output
Browse files Browse the repository at this point in the history
csv-generator was doing string operations on YAML document,
which could produce invalid YAML. This patch removes these
operations.

Signed-off-by: Andrej Krejcir <[email protected]>
  • Loading branch information
akrejcir committed Nov 19, 2021
1 parent 8d40f55 commit b6580c2
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions hack/csv-generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"io"
"io/ioutil"
"os"
"strings"

"github.com/blang/semver/v4"
gyaml "github.com/ghodss/yaml"
Expand Down Expand Up @@ -290,17 +289,6 @@ func marshallObject(obj interface{}, relatedImages []interface{}, writer io.Writ
return err
}

// fix templates by removing unneeded single quotes...
s := string(yamlBytes)
s = strings.Replace(s, "'{{", "{{", -1)
s = strings.Replace(s, "}}'", "}}", -1)

// fix double quoted strings by removing unneeded single quotes...
s = strings.Replace(s, " '\"", " \"", -1)
s = strings.Replace(s, "\"'\n", "\"\n", -1)

yamlBytes = []byte(s)

_, err = writer.Write([]byte("---\n"))
if err != nil {
return err
Expand Down

0 comments on commit b6580c2

Please sign in to comment.