tools: introduce LazyClose()

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2024-07-25 17:28:56 +00:00
parent 05538e6925
commit f0cef6c19f
+9
View File
@@ -1,2 +1,11 @@
// Package tools contains helpers
package tools
import "io"
// LazyClose closes an [io.Closer] and discards the error
func LazyClose(p io.Closer) {
if p != nil {
_ = p.Close()
}
}