From 29e9fd3136f2e2fe301cbe07967fb3bb4ffcee2a Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Fri, 1 Dec 2023 00:52:33 +0100 Subject: fix: Rollback to exp slog repository This is done until go1.21 hits alpine repository. --- pkg/ext/gorm_logger.go | 2 +- pkg/ext/middleware.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'pkg/ext') diff --git a/pkg/ext/gorm_logger.go b/pkg/ext/gorm_logger.go index f0ab592..ddced21 100644 --- a/pkg/ext/gorm_logger.go +++ b/pkg/ext/gorm_logger.go @@ -3,9 +3,9 @@ package ext import ( "context" "fmt" - "log/slog" "time" + "golang.org/x/exp/slog" "gorm.io/gorm/logger" "gorm.io/gorm/utils" ) diff --git a/pkg/ext/middleware.go b/pkg/ext/middleware.go index 38bacca..d9f06e1 100644 --- a/pkg/ext/middleware.go +++ b/pkg/ext/middleware.go @@ -4,10 +4,11 @@ import ( "context" "encoding/base64" "errors" - "log/slog" "net/http" "time" + "golang.org/x/exp/slog" + "git.sr.ht/~gabrielgio/img/pkg/database/repository" "git.sr.ht/~gabrielgio/img/pkg/service" ) @@ -47,7 +48,6 @@ func (l *LogMiddleware) HTTP(next http.HandlerFunc) http.HandlerFunc { slog.Duration("elapsed", elapsed), slog.String("path", r.URL.Path), ) - } } @@ -135,7 +135,6 @@ func NewInitialSetupMiddleware(userRepository repository.UserRepository) *Initia func (i *InitialSetupMiddleware) Check(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - // if user has been set to context it is logged in already token := GetUserFromCtx(r) if token != nil { -- cgit v1.2.3