keep \n in the end of resource yaml

This commit is contained in:
Donny Xia
2021-01-08 15:36:04 -08:00
parent 6f2f401f6b
commit 378eaedc82
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 {