diff --git a/internal/infrastructure/output/yaml.go b/internal/infrastructure/output/yaml.go index 7e378be..c3e2ea9 100644 --- a/internal/infrastructure/output/yaml.go +++ b/internal/infrastructure/output/yaml.go @@ -42,9 +42,12 @@ func (f *YAMLFormatter) Format(result *execution.ExecutionResult) error { encoder := yaml.NewEncoder(f.writer, yaml.Indent(f.indent)) - if err := encoder.Encode(out); err != nil { - return err + encodeErr := encoder.Encode(out) + closeErr := encoder.Close() + + if encodeErr != nil { + return encodeErr } - return encoder.Close() + return closeErr }