From c318a6ef9d2c522a061317c74152edf5552cb460 Mon Sep 17 00:00:00 2001 From: Matheus Pimenta Date: Fri, 10 Apr 2026 20:33:11 +0100 Subject: [PATCH] Address copilot comments Signed-off-by: Matheus Pimenta --- internal/release/v2/util/manifest.go | 2 +- internal/release/v2/util/manifest_test.go | 9 ++++++--- pkg/action/action_test.go | 9 ++++++--- pkg/release/v1/util/manifest.go | 2 +- pkg/release/v1/util/manifest_test.go | 9 ++++++--- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/internal/release/v2/util/manifest.go b/internal/release/v2/util/manifest.go index 8b0083f68..5dbcdaea5 100644 --- a/internal/release/v2/util/manifest.go +++ b/internal/release/v2/util/manifest.go @@ -36,7 +36,7 @@ type SimpleHead struct { var sep = regexp.MustCompile("(?:^|\\s*\n)---\\s*") -// SplitManifests takes a string of manifest and returns a map that contains individual manifests +// SplitManifests takes a manifest string and returns a map containing individual manifests. // // **Note for Chart API v3**: This function (due to the regex above) has allowed _WRONG_ // Go templates to be defined inside charts across the years. The generated text from Go diff --git a/internal/release/v2/util/manifest_test.go b/internal/release/v2/util/manifest_test.go index 8b874af5f..72b095390 100644 --- a/internal/release/v2/util/manifest_test.go +++ b/internal/release/v2/util/manifest_test.go @@ -118,10 +118,13 @@ metadata: }, }, - // Block scalar chomping tests: verify that trailing newlines - // are preserved through SplitManifests for single-doc inputs. + // Block scalar chomping indicator tests using | (clip), |- (strip), and |+ (keep) + // inputs with 0, 1, and 2 trailing newlines after the block content. + // Note: the emitter may normalize the output chomping indicator when the + // trailing newline count makes another indicator equivalent for the result. - // | (clip) + // | (clip) input — clips trailing newlines to exactly one, though with + // 0 trailing newlines the emitted output may normalize to |-. { name: "block scalar clip (|) with 0 trailing newlines", input: ` diff --git a/pkg/action/action_test.go b/pkg/action/action_test.go index 4492bfe3e..d6575a791 100644 --- a/pkg/action/action_test.go +++ b/pkg/action/action_test.go @@ -970,10 +970,13 @@ metadata: `, }, - // Block scalar chomping indicator tests: | (clip), |- (strip), |+ (keep) - // combined with 0, 1, and 2 trailing newlines after the block content. + // Block scalar chomping indicator tests using | (clip), |- (strip), and |+ (keep) + // inputs with 0, 1, and 2 trailing newlines after the block content. + // Note: the emitter may normalize the output chomping indicator when the + // trailing newline count makes another indicator equivalent for the result. - // | (clip) — clips trailing newlines to exactly one + // | (clip) input — clips trailing newlines to exactly one, though with + // 0 trailing newlines the emitted output may normalize to |-. { name: "block scalar clip (|) with 0 trailing newlines", files: map[string]string{ diff --git a/pkg/release/v1/util/manifest.go b/pkg/release/v1/util/manifest.go index 992a4af04..fa26f6256 100644 --- a/pkg/release/v1/util/manifest.go +++ b/pkg/release/v1/util/manifest.go @@ -36,7 +36,7 @@ type SimpleHead struct { var sep = regexp.MustCompile("(?:^|\\s*\n)---\\s*") -// SplitManifests takes a string of manifest and returns a map that contains individual manifests +// SplitManifests takes a manifest string and returns a map containing individual manifests. // // **Note for Chart API v3**: This function (due to the regex above) has allowed _WRONG_ // Go templates to be defined inside charts across the years. The generated text from Go diff --git a/pkg/release/v1/util/manifest_test.go b/pkg/release/v1/util/manifest_test.go index 579c7f891..516ac42d7 100644 --- a/pkg/release/v1/util/manifest_test.go +++ b/pkg/release/v1/util/manifest_test.go @@ -118,10 +118,13 @@ metadata: }, }, - // Block scalar chomping tests: verify that trailing newlines - // are preserved through SplitManifests for single-doc inputs. + // Block scalar chomping indicator tests using | (clip), |- (strip), and |+ (keep) + // inputs with 0, 1, and 2 trailing newlines after the block content. + // Note: the emitter may normalize the output chomping indicator when the + // trailing newline count makes another indicator equivalent for the result. - // | (clip) + // | (clip) input — clips trailing newlines to exactly one, though with + // 0 trailing newlines the emitted output may normalize to |-. { name: "block scalar clip (|) with 0 trailing newlines", input: `