nit: shorter defer body

This commit is contained in:
Motiejus Jakštys 2021-08-29 18:39:43 +03:00 committed by Motiejus Jakštys
parent cca579d218
commit f02af98ac5

View File

@ -153,9 +153,8 @@ func Flatten(rd io.ReadSeeker, w io.Writer, opts ...Option) (_err error) {
defer func() { defer func() {
// Avoiding use of multierr: if error is present, return // Avoiding use of multierr: if error is present, return
// that. Otherwise return whatever `Close` returns. // that. Otherwise return whatever `Close` returns.
err1 := tw.Close() if err := tw.Close(); err != nil && _err == nil {
if _err == nil { _err = err
_err = err1
} }
}() }()
// iterate through all layers, all files, and write files. // iterate through all layers, all files, and write files.