Merge pull request #3431 from Shell32-Natsu/newline

keep \n in the end of resource yaml
This commit is contained in:
Jeff Regan
2021-01-10 12:51:36 -08:00
committed by GitHub
2 changed files with 42 additions and 0 deletions

View File

@@ -149,6 +149,11 @@ func (r *ByteReader) Read() ([]*yaml.RNode, error) {
index := 0
for i := range values {
// the Split used above will eat the tail '\n' from each resource. This may affect the
// literal string value since '\n' is meaningful in it.
if i != len(values)-1 {
values[i] += "\n"
}
decoder := yaml.NewDecoder(bytes.NewBufferString(values[i]))
node, err := r.decode(index, decoder)
if err == io.EOF {