From 9d81cc097119a88b072ebddc31db9ad941c1da44 Mon Sep 17 00:00:00 2001
From: Erik Sundell <erik.i.sundell@gmail.com>
Date: Fri, 6 Apr 2018 00:40:43 +0200
Subject: [PATCH] toYaml - Fixes #3410 - trailing \n issue

`toYaml` utilized by `.Files` was introducing a new line. It is an issue since the new line is part of a functions output, it can't be whitespace chomped away so it would require a `trimSuffix "\n"` pipe. This commit trims one trailing `\n` from the toYaml output.

(cherry picked from commit 35132d141c54598e7dab23207acce7e6fb1dfa4a)
---
 pkg/chartutil/files.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go
index a711a3366..ced8ce15a 100644
--- a/pkg/chartutil/files.go
+++ b/pkg/chartutil/files.go
@@ -175,7 +175,7 @@ func ToYaml(v interface{}) string {
 		// Swallow errors inside of a template.
 		return ""
 	}
-	return string(data)
+	return strings.TrimSuffix(string(data), "\n")
 }
 
 // FromYaml converts a YAML document into a map[string]interface{}.
-- 
GitLab