Browse Source

tools: introduce LazyClose()

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/55/head
Alejandro Mery 2 months ago
parent
commit
f0cef6c19f
  1. 9
      pkg/tools/tools.go

9
pkg/tools/tools.go

@ -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()
}
}

Loading…
Cancel
Save