diff --git a/.golangci.yaml b/.golangci.yaml index 871b62c..864969c 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -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 diff --git a/backends/memory/memory_backend.go b/backends/memory/memory_backend.go index b0ec080..0528cb1 100644 --- a/backends/memory/memory_backend.go +++ b/backends/memory/memory_backend.go @@ -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() } diff --git a/backends/postgres/postgres_backend.go b/backends/postgres/postgres_backend.go index ee97491..3d98dbb 100644 --- a/backends/postgres/postgres_backend.go +++ b/backends/postgres/postgres_backend.go @@ -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) diff --git a/backends/postgres/postgres_backend_test.go b/backends/postgres/postgres_backend_test.go index c41aef4..bfb7271 100644 --- a/backends/postgres/postgres_backend_test.go +++ b/backends/postgres/postgres_backend_test.go @@ -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 diff --git a/backends/redis/redis_backend.go b/backends/redis/redis_backend.go index 6d20f91..5810b4a 100644 --- a/backends/redis/redis_backend.go +++ b/backends/redis/redis_backend.go @@ -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() } diff --git a/flake.nix b/flake.nix index 039cd3c..cd68305 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,7 @@ go_1_21 gomod2nix.legacyPackages.${system}.gomod2nix gotools + golangci-lint go-tools gopls pre-commit