mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-09-18 01:50:50 +00:00
17 lines
324 B
Go
17 lines
324 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
"reflect"
|
||
|
"runtime/debug"
|
||
|
|
||
|
"go.uber.org/zap"
|
||
|
)
|
||
|
|
||
|
func Close(res io.Closer, logger *zap.Logger) {
|
||
|
err := res.Close()
|
||
|
if err != nil {
|
||
|
logger.Error("could not close resource", zap.String("name", reflect.TypeOf(res).String()), zap.Error(err), zap.String("stack", string(debug.Stack())))
|
||
|
}
|
||
|
}
|