docs: Clarify Files.Lines behavior for empty and missing files#2174
Draft
promptless-for-oss wants to merge 2 commits into
Draft
docs: Clarify Files.Lines behavior for empty and missing files#2174promptless-for-oss wants to merge 2 commits into
promptless-for-oss wants to merge 2 commits into
Conversation
Signed-off-by: promptless[bot] <promptless[bot]@users.noreply.github.com>
| {{ . }}{{ end }} | ||
| ``` | ||
|
|
||
| If the file you reference is empty or does not exist, `Lines` returns an empty |
Contributor
Author
There was a problem hiding this comment.
Added the empty/missing-file note because this PR changes files.Lines in pkg/engine/files.go — the guard becomes len(f[path]) == 0 so empty files return an empty []string{} like missing files already did, instead of panicking with index-out-of-range and failing the render.
Source: helm/helm#32303
| {{ . }}{{ end }} | ||
| ``` | ||
|
|
||
| If the file you reference is empty or does not exist, `Lines` returns an empty |
Contributor
Author
There was a problem hiding this comment.
Applied the same Lines note to the current (v4) docs because PR #32303 is the v3 backport of #32290, which lands the identical pkg/engine/files.go fix on main, so the empty-file behavior holds for v4 as well.
Source: helm/helm#32290
…s-empty-file-behavior # Conflicts: # docs/chart_template_guide/accessing_files.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Open this suggestion in Promptless to view citations and reasoning process
Documents that
.Files.Linesreturns an empty list (not an error) when the referenced file is empty or missing, in the Chart Template Guide "Accessing Files Inside Templates" page. Applied to both the current (v4) and v3 docs. Grounded in helm/helm PR #32303, which fixes an index-out-of-range panic on empty files so they behave like missing files.Trigger Events
Tip: Use labels in the Promptless dashboard to categorize suggestions by release or team 🏷️