From 1dc32f78491856085b88217a1686936a8bb6ef5c Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 6 Apr 2018 00:41:14 +0200 Subject: [PATCH] toYaml - Fixes #3470 - trailing \n issue `toYaml` 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 6cdf6cee56dcd90e3dca82950b15d46e6bb4587b) --- pkg/strvals/parser.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 8a16adf7e..aa3d15904 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -36,7 +36,7 @@ func ToYAML(s string) (string, error) { return "", err } d, err := yaml.Marshal(m) - return string(d), err + return strings.TrimSuffix(string(d), "\n"), err } // Parse parses a set line.