diff --git a/example_test.go b/example_test.go index 41d1c3a..a3587bc 100644 --- a/example_test.go +++ b/example_test.go @@ -33,7 +33,7 @@ func ExampleGroup() { // } -func ExampleTrigger() { +func ExampleNew_cancel() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -64,7 +64,7 @@ func ExampleTrigger() { // Output: task 5 failed } -func ExampleListen() { +func ExampleNew_listen() { // The taskgroup itself will only report the first non-nil task error, but // you can use an error listener used to accumulate all of them. // Calls to the listener are synchronized, so we don't need a lock. diff --git a/taskgroup.go b/taskgroup.go index 1dc8d1b..6727c17 100644 --- a/taskgroup.go +++ b/taskgroup.go @@ -178,18 +178,6 @@ func adaptErrorFunc(ef any) errorFunc { } } -// Trigger creates an OnError callback that calls f each time a task reports an -// error. The resulting callback returns task errors unmodified. -// -// Deprecated: Pass f directly to [New] or [Group.OnError]. -func Trigger(f func()) any { return f } - -// Listen creates an OnError callback that reports each non-nil task error to -// f. The resulting callback returns task errors unmodified. -// -// Deprecated: Pass f directly to [New] or [Group.OnError]. -func Listen(f func(error)) any { return f } - // NoError adapts f to a Task that executes f and reports a nil error. func NoError(f func()) Task { return func() error { f(); return nil } } diff --git a/taskgroup_test.go b/taskgroup_test.go index 417e3ed..cad4576 100644 --- a/taskgroup_test.go +++ b/taskgroup_test.go @@ -81,9 +81,9 @@ func TestCancellation(t *testing.T) { defer leaktest.Check(t)() var errs []error - g := taskgroup.New(taskgroup.Listen(func(err error) { + g := taskgroup.New(func(err error) { errs = append(errs, err) - })) + }) errOther := errors.New("something is wrong") ctx, cancel := context.WithCancel(context.Background())