1
0
mirror of https://github.com/golang/go synced 2024-11-17 04:14:52 -07:00

context: update doc comment to link to context interface

Linking to the Context interface in the WithCancel doc comment makes
it more consistent with the WithDeadline and WithTimeout doc comments.
This commit is contained in:
ALX99 2024-02-17 13:29:43 +09:00
parent e41fabd688
commit 9c6bb607a9

View File

@ -231,7 +231,7 @@ type CancelFunc func()
// or when the parent context's Done channel is closed, whichever happens first. // or when the parent context's Done channel is closed, whichever happens first.
// //
// Canceling this context releases resources associated with it, so code should // Canceling this context releases resources associated with it, so code should
// call cancel as soon as the operations running in this Context complete. // call cancel as soon as the operations running in this [Context] complete.
func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
c := withCancel(parent) c := withCancel(parent)
return c, func() { c.cancel(true, Canceled, nil) } return c, func() { c.cancel(true, Canceled, nil) }