Skip to content

Commit 278b017

Browse files
committed
misc: handle unhandled errors
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
1 parent bc55318 commit 278b017

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

internal/runner/post_renderer_kustomize.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ func writeToFile(fs filesys.FileSystem, path string, content []byte) error {
4646
if err != nil {
4747
return err
4848
}
49-
helmOutput.Write(content)
50-
if err := helmOutput.Close(); err != nil {
49+
if _, err = helmOutput.Write(content); err != nil {
50+
return err
51+
}
52+
if err = helmOutput.Close(); err != nil {
5153
return err
5254
}
5355
return nil
@@ -58,8 +60,10 @@ func writeFile(fs filesys.FileSystem, path string, content *bytes.Buffer) error
5860
if err != nil {
5961
return err
6062
}
61-
content.WriteTo(helmOutput)
62-
if err := helmOutput.Close(); err != nil {
63+
if _, err = content.WriteTo(helmOutput); err != nil {
64+
return err
65+
}
66+
if err = helmOutput.Close(); err != nil {
6367
return err
6468
}
6569
return nil

0 commit comments

Comments
 (0)