Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: check error return from yaml.Encoder.Close() in resolveFile#1664

Merged
imjasonh merged 1 commit into
ko-build:mainfrom
SebTardif:fix/check-yaml-encoder-close-error
May 18, 2026
Merged

fix: check error return from yaml.Encoder.Close() in resolveFile#1664
imjasonh merged 1 commit into
ko-build:mainfrom
SebTardif:fix/check-yaml-encoder-close-error

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

resolveFile() in pkg/commands/resolver.go calls yaml.Encoder.Close() without checking its error return value. The Close() method flushes remaining buffered data and can fail; discarding the error means the function may return incomplete YAML to callers without any error indication.

This change checks the error from Close() and propagates it, consistent with how Encode() errors are already handled in the same function.

The yaml.Encoder.Close() method flushes remaining buffered data and
returns an error. In resolveFile(), this error was silently discarded,
which could cause the function to return incomplete or malformed YAML
without any error indication.

Check the error and propagate it to the caller.

Signed-off-by: Sebastien Tardif <[email protected]>
@imjasonh imjasonh merged commit 84e91d4 into ko-build:main May 18, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants