mirror of
https://github.com/asticode/go-astikit.git
synced 2026-04-22 23:07:17 +08:00
Added CloseWithoutErrorFunc
This commit is contained in:
@@ -4,8 +4,8 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// CloseFunc is a method that closes something
|
||||
type CloseFunc func() error
|
||||
type CloseWithoutErrorFunc func()
|
||||
|
||||
// Closer is an object that can close several things
|
||||
type Closer struct {
|
||||
@@ -72,7 +72,7 @@ func (c *Closer) Add(f CloseFunc) {
|
||||
c.fs = append([]CloseFunc{f}, c.fs...)
|
||||
}
|
||||
|
||||
func (c *Closer) AddWithoutError(f func()) {
|
||||
func (c *Closer) AddWithoutError(f CloseWithoutErrorFunc) {
|
||||
c.Add(func() error {
|
||||
f()
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user