Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor writeManifests function for simplification and better error handling (#19446) #19447

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

juwon8891
Copy link
Member

Closed #19446

…error handling

Signed-off-by: Juwon Hwang (Kevin) <juwon8891@gmail.com>
@juwon8891 juwon8891 requested a review from a team as a code owner August 8, 2024 19:28
Comment on lines 130 to +139
buf := bytes.Buffer{}
enc := yaml.NewEncoder(&buf)
enc.SetIndent(2)

defer func() {
if cerr := enc.Close(); cerr != nil {
log.WithError(cerr).Error("failed to close yaml encoder")
}
}()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could skip the bytes buffer entirely and encode directly to the file... not sure how that works with multiple documents.

I assume we'd then use a shared encoder instead of creating a new one for each manifest.

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local test checks out, thanks!

@crenshaw-dev crenshaw-dev merged commit 6045ea2 into argoproj:hydrator Aug 12, 2024
8 of 9 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