Skip to content

Commit 0d25c07

Browse files
committed
Separate Adder interface
1 parent a84ed02 commit 0d25c07

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

closer/closer.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@ import (
1212

1313
type CloseFn func(ctx context.Context) error
1414

15-
// Closer allows to register functions to clean up resources.
15+
// Closer cleans up resources.
1616
type Closer interface {
17+
Adder
1718
// SetContext sets context which will be passed into the close functions without cancel.
1819
SetContext(ctx context.Context)
19-
// Add adds close function.
20-
Add(CloseFn)
2120
// Done returns signal channel.
2221
Done() <-chan struct{}
23-
// Err returns joint error based on close functions errors.
22+
// Err returns a joint error based on close functions errors.
2423
Err() error
2524
// CloseAll runs close functions in arbitrary order.
2625
CloseAll()
2726
}
2827

28+
// Adder allows registering functions to clean up resources.
29+
type Adder interface {
30+
// Add adds close function.
31+
Add(CloseFn)
32+
}
33+
2934
type closer struct {
3035
done chan struct{}
3136
ctx atomic.Pointer[context.Context]

0 commit comments

Comments
 (0)