mirror of
https://github.com/hibiken/asynq.git
synced 2026-01-30 05:34:24 +00:00
ci: format code with golangci-lint
This commit is contained in:
@@ -11,11 +11,11 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"github.com/hibiken/asynq/internal/log"
|
||||
h "github.com/hibiken/asynq/internal/testutil"
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
//============================================================================
|
||||
|
||||
3
doc.go
3
doc.go
@@ -16,7 +16,6 @@ specify the connection using one of RedisConnOpt types.
|
||||
|
||||
The Client is used to enqueue a task.
|
||||
|
||||
|
||||
client := asynq.NewClient(redisConnOpt)
|
||||
|
||||
// Task is created with two parameters: its type and payload.
|
||||
@@ -36,6 +35,7 @@ The Client is used to enqueue a task.
|
||||
|
||||
The Server is used to run the task processing workers with a given
|
||||
handler.
|
||||
|
||||
srv := asynq.NewServer(redisConnOpt, asynq.Config{
|
||||
Concurrency: 10,
|
||||
})
|
||||
@@ -50,6 +50,7 @@ the processing is successful, otherwise return a non-nil error.
|
||||
If handler panics or returns a non-nil error, the task will be retried in the future.
|
||||
|
||||
Example of a type that implements the Handler interface.
|
||||
|
||||
type TaskHandler struct {
|
||||
// ...
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ type Op string
|
||||
// only the last one is recorded.
|
||||
//
|
||||
// The types are:
|
||||
//
|
||||
// errors.Op
|
||||
// The operation being performed, usually the method
|
||||
// being invoked (Get, Put, etc.).
|
||||
|
||||
@@ -156,5 +156,5 @@ func NotFound(ctx context.Context, task *Task) error {
|
||||
return fmt.Errorf("%w %q", ErrHandlerNotFound, task.Type())
|
||||
}
|
||||
|
||||
// NotFoundHandler returns a simple task handler that returns a ``not found`` error.
|
||||
// NotFoundHandler returns a simple task handler that returns a “not found“ error.
|
||||
func NotFoundHandler() Handler { return HandlerFunc(NotFound) }
|
||||
|
||||
@@ -24,7 +24,7 @@ func makeFakeHandler(identity string) Handler {
|
||||
}
|
||||
|
||||
// makeFakeMiddleware returns a middleware function that appends the given identity
|
||||
//to the global invoked slice.
|
||||
// to the global invoked slice.
|
||||
func makeFakeMiddleware(identity string) MiddlewareFunc {
|
||||
return func(next Handler) Handler {
|
||||
return HandlerFunc(func(ctx context.Context, t *Task) error {
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/hibiken/asynq/internal/base"
|
||||
"github.com/hibiken/asynq/internal/log"
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
type subscriber struct {
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
// ScreenDrawer is used to draw contents on screen.
|
||||
//
|
||||
// Usage example:
|
||||
//
|
||||
// d := NewScreenDrawer(s)
|
||||
// d.Println("Hello world", mystyle)
|
||||
// d.NL() // adds newline
|
||||
|
||||
@@ -414,18 +414,22 @@ func getTLSConfig() *tls.Config {
|
||||
// cols is a list of headers and printRow specifies how to print rows.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// type User struct {
|
||||
// Name string
|
||||
// Addr string
|
||||
// Age int
|
||||
// }
|
||||
//
|
||||
// data := []*User{{"user1", "addr1", 24}, {"user2", "addr2", 42}, ...}
|
||||
// cols := []string{"Name", "Addr", "Age"}
|
||||
//
|
||||
// printRows := func(w io.Writer, tmpl string) {
|
||||
// for _, u := range data {
|
||||
// fmt.Fprintf(w, tmpl, u.Name, u.Addr, u.Age)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// printTable(cols, printRows)
|
||||
func printTable(cols []string, printRows func(w io.Writer, tmpl string)) {
|
||||
format := strings.Repeat("%v\t", len(cols)) + "\n"
|
||||
|
||||
@@ -770,4 +770,3 @@ func taskRunAll(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
fmt.Printf("%d tasks are now pending\n", n)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user