mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
15 lines
353 B
Go
15 lines
353 B
Go
package internal
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/anchore/syft/internal/log"
|
|
)
|
|
|
|
// CloseAndLogError closes the given io.Closer and reports any errors found as a warning in the log
|
|
func CloseAndLogError(closer io.Closer, location string) {
|
|
if err := closer.Close(); err != nil {
|
|
log.Warnf("unable to close file for location=%q: %+v", location, err)
|
|
}
|
|
}
|