2023-02-23 09:50:52 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
2024-03-14 12:33:52 +00:00
|
|
|
"log/slog"
|
2023-02-23 09:50:52 +00:00
|
|
|
"reflect"
|
|
|
|
"runtime/debug"
|
2024-03-16 00:20:15 +00:00
|
|
|
|
|
|
|
"git.sr.ht/~ashkeel/strimertul/log"
|
2023-02-23 09:50:52 +00:00
|
|
|
)
|
|
|
|
|
2024-03-14 12:33:52 +00:00
|
|
|
func Close(res io.Closer) {
|
2023-02-23 09:50:52 +00:00
|
|
|
err := res.Close()
|
|
|
|
if err != nil {
|
2024-03-16 00:20:15 +00:00
|
|
|
slog.Error("Could not close resource", slog.String("name", reflect.TypeOf(res).String()), slog.String("stack", string(debug.Stack())), log.Error(err))
|
2023-02-23 09:50:52 +00:00
|
|
|
}
|
|
|
|
}
|