tools: introduce LazyClose()
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user