Skip to content

Commit 96fe017

Browse files
committed
clarify context docs
1 parent 8df2bbf commit 96fe017

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

example_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ func ExampleNewTask() {
362362
gocron.DurationJob(time.Second),
363363
gocron.NewTask(
364364
func(ctx context.Context) {
365-
// gocron will pass in a context (either the default Job context, or one provided via WithContext)
366-
// to the job and will cancel the context on shutdown.
365+
// gocron will pass in a context (either the default Job context, or one
366+
// provided via WithContext) to the job and will cancel the context on shutdown.
367367
// This allows you to listen for and handle cancellation within your job.
368368
},
369369
),
@@ -627,8 +627,8 @@ func ExampleWithContext() {
627627
),
628628
gocron.NewTask(
629629
func(ctx context.Context) {
630-
// gocron will pass in a context (either the default Job context, or one provided via WithContext)
631-
// to the job and will cancel the context on shutdown.
630+
// gocron will pass in a context (either the default Job context, or one
631+
// provided via WithContext) to the job and will cancel the context on shutdown.
632632
// This allows you to listen for and handle cancellation within your job.
633633
},
634634
),

job.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ type Task func() task
8484

8585
// NewTask provides the job's task function and parameters.
8686
// If you set the first argument of your Task func to be a context.Context,
87-
// gocron will pass in a context (either the default Job context, or one provided via WithContext)
88-
// to the job and will cancel the context on shutdown.
87+
// gocron will pass in a context (either the default Job context, or one
88+
// provided via WithContext) to the job and will cancel the context on shutdown.
8989
// This allows you to listen for and handle cancellation within your job.
9090
func NewTask(function any, parameters ...any) Task {
9191
return func() task {
@@ -710,8 +710,8 @@ func WithIdentifier(id uuid.UUID) JobOption {
710710

711711
// WithContext sets the parent context for the job
712712
// If you set the first argument of your Task func to be a context.Context,
713-
// gocron will pass in a context (either the default Job context, or one provided via WithContext)
714-
// to the job and will cancel the context on shutdown.
713+
// gocron will pass in a context (either the default Job context, or one
714+
// provided via WithContext) to the job and will cancel the context on shutdown.
715715
// This allows you to listen for and handle cancellation within your job.
716716
func WithContext(ctx context.Context) JobOption {
717717
return func(j *internalJob, _ time.Time) error {

scheduler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ type Scheduler interface {
2222
// definition when the Scheduler is started. If the Scheduler is already running
2323
// the job will be scheduled when the Scheduler is started.
2424
// If you set the first argument of your Task func to be a context.Context,
25-
// gocron will pass in a context (either the default Job context, or one provided via WithContext)
26-
// to the job and will cancel the context on shutdown.
25+
// gocron will pass in a context (either the default Job context, or one
26+
// provided via WithContext) to the job and will cancel the context on shutdown.
2727
// This allows you to listen for and handle cancellation within your job.
2828
NewJob(JobDefinition, Task, ...JobOption) (Job, error)
2929
// RemoveByTags removes all jobs that have at least one of the provided tags.

0 commit comments

Comments
 (0)