Fix lints

This commit is contained in:
Adriano Caloiaro 2024-01-26 08:51:20 -07:00 committed by Adriano Caloiaro
parent f21eb9c282
commit 7798b35827
6 changed files with 5 additions and 15 deletions

View file

@ -50,14 +50,6 @@ output:
#It's a .golangci.yml config file of this repo: we enable more linters than the default and have more strict settings:
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
@ -115,7 +107,6 @@ linters:
- contextcheck
- cyclop
- decorder
- depguard
- dogsled
- dupl
- dupword
@ -155,7 +146,6 @@ linters:
- maintidx
- makezero
- misspell
- nakedret
- nestif
- nilerr
- nilnil

View file

@ -67,7 +67,7 @@ func Backend(_ context.Context, opts ...neoq.ConfigOption) (backend neoq.Neoq, e
}
// Enqueue queues jobs to be executed asynchronously
func (m *MemBackend) Enqueue(ctx context.Context, job *jobs.Job) (jobID string, err error) {
func (m *MemBackend) Enqueue(_ context.Context, job *jobs.Job) (jobID string, err error) {
var queueChan chan *jobs.Job
var qc any
var ok bool
@ -194,7 +194,7 @@ func (m *MemBackend) SetLogger(logger logging.Logger) {
}
// Shutdown halts the worker
func (m *MemBackend) Shutdown(ctx context.Context) {
func (m *MemBackend) Shutdown(_ context.Context) {
for _, f := range m.cancelFuncs {
f()
}

View file

@ -403,6 +403,7 @@ func (p *PgBackend) Enqueue(ctx context.Context, job *jobs.Job) (jobID string, e
}
p.logger.Error("error enqueueing job", slog.String("queue", job.Queue), slog.Any("error", err))
err = fmt.Errorf("error enqueuing job: %w", err)
return
}
err = tx.Commit(ctx)

View file

@ -406,8 +406,6 @@ func TestMultipleCronNodes(t *testing.T) {
_, exists := jobsProcessed.LoadOrStore(job.ID, "foo")
if exists {
t.Fatalf("job (%d) has already been processed by another worker!", job.ID)
atomic.AddUint32(&duplicateJobs, 1)
return nil
}
atomic.AddUint32(&jobsCompleted, 1)
return

View file

@ -342,7 +342,7 @@ func (b *RedisBackend) SetLogger(logger logging.Logger) {
}
// Shutdown halts the worker
func (b *RedisBackend) Shutdown(ctx context.Context) {
func (b *RedisBackend) Shutdown(_ context.Context) {
b.client.Close()
b.server.Shutdown()
}

View file

@ -34,6 +34,7 @@
go_1_21
gomod2nix.legacyPackages.${system}.gomod2nix
gotools
golangci-lint
go-tools
gopls
pre-commit