Skip to content

Commit 645ab56

Browse files
committed
Fix lint errors
1 parent 5dff377 commit 645ab56

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cmd/migrations.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package cmd
22

33
import (
44
"fmt"
5+
"log/slog"
6+
57
_ "github.com/golang-migrate/migrate/v4/source/file"
68
_ "github.com/lib/pq"
79
"github.com/mraron/njudge/internal/njudge/db/migrations"
810
"github.com/spf13/cobra"
911
"github.com/spf13/viper"
10-
"log/slog"
1112
)
1213

1314
type MigrateCmdArgs struct {
@@ -35,7 +36,9 @@ func NewMigrateCommand(v *viper.Viper) *cobra.Command {
3536
}
3637

3738
m, err := migrations.NewMigrate(db, true)
38-
39+
if err != nil {
40+
return err
41+
}
3942
if migrateArgs.Up {
4043
err = m.Up()
4144
if err != nil {

internal/web/jobs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (s *Server) pruneUnactivatedUsers(ctx context.Context) {
2626
for {
2727
lst, err := s.Users.GetAll(ctx)
2828
if err != nil {
29-
s.Logger.ErrorContext(ctx, "error pruning unactivated users", err)
29+
s.Logger.ErrorContext(ctx, "error pruning unactivated users", "error", err)
3030
}
3131
cnt := 0
3232
for ind := range lst {
@@ -36,7 +36,7 @@ func (s *Server) pruneUnactivatedUsers(ctx context.Context) {
3636
}
3737
}
3838
if err != nil {
39-
s.Logger.ErrorContext(ctx, "error occured while pruning", err)
39+
s.Logger.ErrorContext(ctx, "error occured while pruning", "error", err)
4040
}else {
4141
s.Logger.InfoContext(ctx, fmt.Sprintf("pruned %d inactive, unactivated accounts", cnt))
4242
}

0 commit comments

Comments
 (0)