Skip to content

Commit

Permalink
taskgroup: mark NoError as deprecated
Browse files Browse the repository at this point in the history
Remove the last remaining use in the package, and add a deprecation annotation
so staticcheck et al. will complain about it.
  • Loading branch information
creachadair committed Nov 22, 2024
1 parent 355e2c5 commit dba67ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions taskgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ func adaptErrorFunc(ef any) errorFunc {
}

// NoError adapts f to a Task that executes f and reports a nil error.
//
// Deprecated: Use [Group.Run] or [taskgroup.Run] instead.
func NoError(f func()) Task { return func() error { f(); return nil } }

func noError(f func()) Task { return func() error { f(); return nil } }
Expand Down
2 changes: 1 addition & 1 deletion throttle.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ func (s StartFunc) Go(task Task) { s(task) }

// Run is a legibility shorthand for calling s with a task that runs f and
// reports a nil error.
func (s StartFunc) Run(f func()) { s(NoError(f)) }
func (s StartFunc) Run(f func()) { s(noError(f)) }

0 comments on commit dba67ba

Please sign in to comment.