From 779cfbfc64c1f40a98fe322c53eb232e4526440f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 19:56:03 +0100 Subject: [PATCH] [+] bump `golangci/golangci-lint-action` from 3 to 4 (#640) Bump golangci/golangci-lint-action from 3 to 4 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3 to 4. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v3...v4) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pavlo Golub --- .github/workflows/build.yml | 2 +- internal/pgengine/access_test.go | 2 +- internal/pgengine/bootstrap.go | 4 ++-- internal/pgengine/migration.go | 2 +- internal/scheduler/chain_test.go | 10 +++++----- internal/scheduler/interval_chain_test.go | 6 +++--- internal/tasks/mail_test.go | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71af544e..2a99d497 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,7 +125,7 @@ jobs: go version - name: GolangCI-Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: version: latest diff --git a/internal/pgengine/access_test.go b/internal/pgengine/access_test.go index 683f7db4..c4c64a5d 100644 --- a/internal/pgengine/access_test.go +++ b/internal/pgengine/access_test.go @@ -104,7 +104,7 @@ func TestLogChainElementExecution(t *testing.T) { pge := pgengine.NewDB(mockPool, "pgengine_unit_test") defer mockPool.Close() - t.Run("Check LogChainElementExecution if sql fails", func(t *testing.T) { + t.Run("Check LogChainElementExecution if sql fails", func(*testing.T) { mockPool.ExpectExec("INSERT INTO .*execution_log").WithArgs( pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg(), pgxmock.AnyArg()). diff --git a/internal/pgengine/bootstrap.go b/internal/pgengine/bootstrap.go index f0449f19..c0ad9426 100644 --- a/internal/pgengine/bootstrap.go +++ b/internal/pgengine/bootstrap.go @@ -98,7 +98,7 @@ func New(ctx context.Context, cmdOpts config.CmdOptions, logger log.LoggerHooker config := pge.getPgxConnConfig() if err = retry.Do(connctx, backoff, func(ctx context.Context) error { - if pge.ConfigDb, err = pgxpool.NewWithConfig(connctx, config); err == nil { + if pge.ConfigDb, err = pgxpool.NewWithConfig(ctx, config); err == nil { err = pge.ConfigDb.Ping(connctx) } if err != nil { @@ -161,7 +161,7 @@ func (pge *PgEngine) getPgxConnConfig() *pgxpool.Config { // and another connection for LogHook.send() connConfig.MaxConns = int32(pge.Resource.CronWorkers) + int32(pge.Resource.IntervalWorkers) + 3 connConfig.ConnConfig.RuntimeParams["application_name"] = "pg_timetable" - connConfig.ConnConfig.OnNotice = func(c *pgconn.PgConn, n *pgconn.Notice) { + connConfig.ConnConfig.OnNotice = func(_ *pgconn.PgConn, n *pgconn.Notice) { pge.l.WithField("severity", n.Severity).WithField("notice", n.Message).Info("Notice received") } connConfig.AfterConnect = func(ctx context.Context, pgconn *pgx.Conn) (err error) { diff --git a/internal/pgengine/migration.go b/internal/pgengine/migration.go index 6394eb6c..b1852d61 100644 --- a/internal/pgengine/migration.go +++ b/internal/pgengine/migration.go @@ -58,7 +58,7 @@ var Migrations func() migrator.Option = func() migrator.Option { return migrator.Migrations( &migrator.Migration{ Name: "00259 Restart migrations for v4", - Func: func(ctx context.Context, tx pgx.Tx) error { + Func: func(context.Context, pgx.Tx) error { // "migrations" table will be created automatically return nil }, diff --git a/internal/scheduler/chain_test.go b/internal/scheduler/chain_test.go index bbe654cf..a666fc7d 100644 --- a/internal/scheduler/chain_test.go +++ b/internal/scheduler/chain_test.go @@ -63,14 +63,14 @@ func TestChainWorker(t *testing.T) { sch := New(pge, log.Init(config.LoggingOpts{LogLevel: "error"})) chains := make(chan Chain, 16) - t.Run("Check chainWorker if context cancelled", func(t *testing.T) { + t.Run("Check chainWorker if context cancelled", func(*testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() chains <- Chain{} sch.chainWorker(ctx, chains) }) - t.Run("Check chainWorker if everything fine", func(t *testing.T) { + t.Run("Check chainWorker if everything fine", func(*testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() mock.ExpectQuery("SELECT count").WillReturnError(pgx.ErrNoRows) @@ -82,7 +82,7 @@ func TestChainWorker(t *testing.T) { sch.chainWorker(ctx, chains) }) - t.Run("Check chainWorker if cannot proceed with chain execution", func(t *testing.T) { + t.Run("Check chainWorker if cannot proceed with chain execution", func(*testing.T) { ctx, cancel := context.WithTimeout(context.Background(), pgengine.WaitTime+2) defer cancel() mock.ExpectQuery("SELECT count").WillReturnError(errors.New("expected")) @@ -130,13 +130,13 @@ func TestExecuteOnErrorHandler(t *testing.T) { assert.NoError(t, mock.ExpectationsWereMet()) }) - t.Run("check error handler if context cancelled", func(t *testing.T) { + t.Run("check error handler if context cancelled", func(*testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() sch.executeOnErrorHandler(ctx, c) }) - t.Run("check error handler if error", func(t *testing.T) { + t.Run("check error handler if error", func(*testing.T) { mock.ExpectExec("FOO").WillReturnError(errors.New("Syntax error near FOO")) sch.executeOnErrorHandler(context.Background(), c) }) diff --git a/internal/scheduler/interval_chain_test.go b/internal/scheduler/interval_chain_test.go index e3e6ceb2..c1822728 100644 --- a/internal/scheduler/interval_chain_test.go +++ b/internal/scheduler/interval_chain_test.go @@ -25,21 +25,21 @@ func TestIntervalChain(t *testing.T) { sch.intervalChains[ichain.ChainID] = ichain assert.True(t, sch.isValid(ichain)) - t.Run("Check reschedule if self destructive", func(t *testing.T) { + t.Run("Check reschedule if self destructive", func(*testing.T) { mock.ExpectExec("INSERT INTO timetable\\.log").WillReturnResult(pgxmock.NewResult("EXECUTE", 1)) mock.ExpectExec("DELETE").WillReturnResult(pgxmock.NewResult("EXECUTE", 1)) ichain.SelfDestruct = true sch.reschedule(context.Background(), ichain) }) - t.Run("Check reschedule if context cancelled", func(t *testing.T) { + t.Run("Check reschedule if context cancelled", func(*testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() ichain.SelfDestruct = false sch.reschedule(ctx, ichain) }) - t.Run("Check reschedule if everything fine", func(t *testing.T) { + t.Run("Check reschedule if everything fine", func(*testing.T) { ichain.Interval = 1 sch.reschedule(context.Background(), ichain) }) diff --git a/internal/tasks/mail_test.go b/internal/tasks/mail_test.go index 53d1ee79..06c6d7ff 100644 --- a/internal/tasks/mail_test.go +++ b/internal/tasks/mail_test.go @@ -18,7 +18,7 @@ func (d *fakeDialer) DialAndSend(context.Context, ...*gomail.Message) error { func TestTaskSendMail(t *testing.T) { assert.NotNil(t, NewDialer("", 0, "", ""), "Default dialer should be created") - NewDialer = func(host string, port int, username, password string) Dialer { + NewDialer = func(string, int, string, string) Dialer { return &fakeDialer{} } assert.NoError(t, SendMail(context.Background(), EmailConn{