From 36432f74b8b15bb733b3abaec0a1b4bf41d0da8c Mon Sep 17 00:00:00 2001 From: waterWang <672684719@qq.com> Date: Sat, 22 Aug 2026 13:56:18 +0800 Subject: [PATCH] fix(template): trim trailing newline from hooks and show-only output --- pkg/cmd/template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/template.go b/pkg/cmd/template.go index 29839b871..db2f629c8 100644 --- a/pkg/cmd/template.go +++ b/pkg/cmd/template.go @@ -127,7 +127,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { continue } if client.OutputDir == "" { - fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, m.Manifest) + fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, strings.TrimRight(m.Manifest, "\n")) } else { newDir := client.OutputDir if client.UseReleaseName { @@ -195,7 +195,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { } } for _, m := range manifestsToRender { - fmt.Fprintf(out, "---\n%s\n", m) + fmt.Fprintf(out, "---\n%s\n", strings.TrimRight(m, "\n")) } } else { fmt.Fprintf(out, "%s", manifests.String())