From 30d409371b71a866c2e9e2d213b35e4cd071b123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=E1=BB=8Bnh=20=C4=90=E1=BB=A9c=20B=E1=BA=A3o=20Linh?= Date: Tue, 17 May 2022 11:14:15 +0700 Subject: [PATCH] Fix comment typos --- asynq.go | 2 +- context.go | 2 +- inspector.go | 2 +- internal/base/base.go | 6 +++--- internal/context/context.go | 2 +- internal/errors/errors.go | 18 +++++++++--------- scheduler.go | 2 +- server.go | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/asynq.go b/asynq.go index 376f558..da4160d 100644 --- a/asynq.go +++ b/asynq.go @@ -201,7 +201,7 @@ const ( // Indicates that the task is processed successfully and retained until the retention TTL expires. TaskStateCompleted - // Indicates that the task is waiting in a group to be aggreated into one task. + // Indicates that the task is waiting in a group to be aggregated into one task. TaskStateAggregating ) diff --git a/context.go b/context.go index f7ccf04..1ca1f18 100644 --- a/context.go +++ b/context.go @@ -28,7 +28,7 @@ func GetRetryCount(ctx context.Context) (n int, ok bool) { // GetMaxRetry extracts maximum retry from a context, if any. // -// Return value n indicates the maximum number of times the assoicated task +// Return value n indicates the maximum number of times the associated task // can be retried if ProcessTask returns a non-nil error. func GetMaxRetry(ctx context.Context) (n int, ok bool) { return asynqcontext.GetMaxRetry(ctx) diff --git a/inspector.go b/inspector.go index 2ae6c52..e583cf6 100644 --- a/inspector.go +++ b/inspector.go @@ -59,7 +59,7 @@ func (i *Inspector) Groups(queue string) ([]*GroupInfo, error) { return res, nil } -// GroupInfo represents a state of a group at a cerntain time. +// GroupInfo represents a state of a group at a certain time. type GroupInfo struct { // Name of the group. Group string diff --git a/internal/base/base.go b/internal/base/base.go index d42b882..ec342f8 100644 --- a/internal/base/base.go +++ b/internal/base/base.go @@ -607,7 +607,7 @@ func DecodeSchedulerEnqueueEvent(b []byte) (*SchedulerEnqueueEvent, error) { // Cancelations is a collection that holds cancel functions for all active tasks. // -// Cancelations are safe for concurrent use by multipel goroutines. +// Cancelations are safe for concurrent use by multiple goroutines. type Cancelations struct { mu sync.Mutex cancelFuncs map[string]context.CancelFunc @@ -662,7 +662,7 @@ func NewLease(expirationTime time.Time) *Lease { } } -// Reset chanegs the lease to expire at the given time. +// Reset changes the lease to expire at the given time. // It returns true if the lease is still valid and reset operation was successful, false if the lease had been expired. func (l *Lease) Reset(expirationTime time.Time) bool { if !l.IsValid() { @@ -700,7 +700,7 @@ func (l *Lease) Deadline() time.Time { return l.expireAt } -// IsValid returns true if the lease's expieration time is in the future or equals to the current time, +// IsValid returns true if the lease's expiration time is in the future or equals to the current time, // returns false otherwise. func (l *Lease) IsValid() bool { now := l.Clock.Now() diff --git a/internal/context/context.go b/internal/context/context.go index 588ea89..dec9ad0 100644 --- a/internal/context/context.go +++ b/internal/context/context.go @@ -65,7 +65,7 @@ func GetRetryCount(ctx context.Context) (n int, ok bool) { // GetMaxRetry extracts maximum retry from a context, if any. // -// Return value n indicates the maximum number of times the assoicated task +// Return value n indicates the maximum number of times the associated task // can be retried if ProcessTask returns a non-nil error. func GetMaxRetry(ctx context.Context) (n int, ok bool) { metadata, ok := ctx.Value(metadataCtxKey).(taskMetadata) diff --git a/internal/errors/errors.go b/internal/errors/errors.go index 939893d..4b42124 100644 --- a/internal/errors/errors.go +++ b/internal/errors/errors.go @@ -161,7 +161,7 @@ func CanonicalCode(err error) Code { } /****************************************** - Domin Specific Error Types & Values + Domain Specific Error Types & Values *******************************************/ var ( @@ -263,26 +263,26 @@ func IsRedisCommandError(err error) bool { // New returns an error that formats as the given text. // Each call to New returns a distinct error value even if the text is identical. // -// This function is the errors.New function from the standard libarary (https://golang.org/pkg/errors/#New). -// It is exported from this package for import convinience. +// This function is the errors.New function from the standard library (https://golang.org/pkg/errors/#New). +// It is exported from this package for import convenience. func New(text string) error { return errors.New(text) } // Is reports whether any error in err's chain matches target. // -// This function is the errors.Is function from the standard libarary (https://golang.org/pkg/errors/#Is). -// It is exported from this package for import convinience. +// This function is the errors.Is function from the standard library (https://golang.org/pkg/errors/#Is). +// It is exported from this package for import convenience. func Is(err, target error) bool { return errors.Is(err, target) } // As finds the first error in err's chain that matches target, and if so, sets target to that error value and returns true. // Otherwise, it returns false. // -// This function is the errors.As function from the standard libarary (https://golang.org/pkg/errors/#As). -// It is exported from this package for import convinience. +// This function is the errors.As function from the standard library (https://golang.org/pkg/errors/#As). +// It is exported from this package for import convenience. func As(err error, target interface{}) bool { return errors.As(err, target) } // Unwrap returns the result of calling the Unwrap method on err, if err's type contains an Unwrap method returning error. // Otherwise, Unwrap returns nil. // -// This function is the errors.Unwrap function from the standard libarary (https://golang.org/pkg/errors/#Unwrap). -// It is exported from this package for import convinience. +// This function is the errors.Unwrap function from the standard library (https://golang.org/pkg/errors/#Unwrap). +// It is exported from this package for import convenience. func Unwrap(err error) error { return errors.Unwrap(err) } diff --git a/scheduler.go b/scheduler.go index dcb0aa0..4a9eed5 100644 --- a/scheduler.go +++ b/scheduler.go @@ -110,7 +110,7 @@ type SchedulerOpts struct { EnqueueErrorHandler func(task *Task, opts []Option, err error) } -// enqueueJob encapsulates the job of enqueing a task and recording the event. +// enqueueJob encapsulates the job of enqueuing a task and recording the event. type enqueueJob struct { id uuid.UUID cronspec string diff --git a/server.go b/server.go index c8bcbc2..4bf04e0 100644 --- a/server.go +++ b/server.go @@ -242,7 +242,7 @@ func (fn GroupAggregatorFunc) Aggregate(group string, tasks []*Task) *Task { return fn(group, tasks) } -// An ErrorHandler handles an error occured during task processing. +// An ErrorHandler handles an error occurred during task processing. type ErrorHandler interface { HandleError(ctx context.Context, task *Task, err error) }