diff --git a/cmd/migrations.go b/cmd/migrations.go index 9c25f7c..f82c605 100644 --- a/cmd/migrations.go +++ b/cmd/migrations.go @@ -2,12 +2,13 @@ package cmd import ( "fmt" + "log/slog" + _ "github.com/golang-migrate/migrate/v4/source/file" _ "github.com/lib/pq" "github.com/mraron/njudge/internal/njudge/db/migrations" "github.com/spf13/cobra" "github.com/spf13/viper" - "log/slog" ) type MigrateCmdArgs struct { @@ -35,7 +36,9 @@ func NewMigrateCommand(v *viper.Viper) *cobra.Command { } m, err := migrations.NewMigrate(db, true) - + if err != nil { + return err + } if migrateArgs.Up { err = m.Up() if err != nil { diff --git a/internal/web/jobs.go b/internal/web/jobs.go index 326976d..37adab3 100644 --- a/internal/web/jobs.go +++ b/internal/web/jobs.go @@ -26,7 +26,7 @@ func (s *Server) pruneUnactivatedUsers(ctx context.Context) { for { lst, err := s.Users.GetAll(ctx) if err != nil { - s.Logger.ErrorContext(ctx, "error pruning unactivated users", err) + s.Logger.ErrorContext(ctx, "error pruning unactivated users", "error", err) } cnt := 0 for ind := range lst { @@ -36,7 +36,7 @@ func (s *Server) pruneUnactivatedUsers(ctx context.Context) { } } if err != nil { - s.Logger.ErrorContext(ctx, "error occured while pruning", err) + s.Logger.ErrorContext(ctx, "error occured while pruning", "error", err) }else { s.Logger.InfoContext(ctx, fmt.Sprintf("pruned %d inactive, unactivated accounts", cnt)) }