diff options
-rw-r--r-- | cmd/server/main.go | 2 | ||||
-rw-r--r-- | go.mod | 1 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-rw-r--r-- | pkg/ext/gorm_logger.go | 2 | ||||
-rw-r--r-- | pkg/ext/middleware.go | 5 | ||||
-rw-r--r-- | pkg/service/filesystem.go | 1 | ||||
-rw-r--r-- | pkg/worker/list_processor.go | 3 | ||||
-rw-r--r-- | pkg/worker/list_processor_test.go | 3 |
8 files changed, 11 insertions, 8 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go index c2160c4..a7143d2 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -4,7 +4,6 @@ import ( "context" "encoding/base64" "errors" - "log/slog" "net/http" "os" "os/signal" @@ -13,6 +12,7 @@ import ( "github.com/glebarez/sqlite" "github.com/gorilla/mux" flag "github.com/spf13/pflag" + "golang.org/x/exp/slog" "gorm.io/driver/mysql" "gorm.io/driver/postgres" "gorm.io/gorm" @@ -11,6 +11,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/valyala/quicktemplate v1.7.0 golang.org/x/crypto v0.8.0 + golang.org/x/exp v0.0.0-20231127185646-65229373498e gorm.io/driver/mysql v1.5.1 gorm.io/driver/postgres v1.5.2 gorm.io/driver/sqlite v1.5.0 @@ -63,6 +63,8 @@ github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7Fw golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= +golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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 { diff --git a/pkg/service/filesystem.go b/pkg/service/filesystem.go index 1364fd8..34eda61 100644 --- a/pkg/service/filesystem.go +++ b/pkg/service/filesystem.go @@ -104,7 +104,6 @@ func (f *FileSystemController) IsFile(ctx context.Context, fullPath string) (boo } func (f *FileSystemController) GetPage(ctx context.Context, filename string, fullPath string) (*Page, error) { - files, err := f.fsRepository.List(fullPath) if err != nil { return nil, err diff --git a/pkg/worker/list_processor.go b/pkg/worker/list_processor.go index c4c3781..2a51466 100644 --- a/pkg/worker/list_processor.go +++ b/pkg/worker/list_processor.go @@ -3,8 +3,9 @@ package worker import ( "context" "errors" - "log/slog" "sync" + + "golang.org/x/exp/slog" ) type ( diff --git a/pkg/worker/list_processor_test.go b/pkg/worker/list_processor_test.go index 21489e8..053ebbd 100644 --- a/pkg/worker/list_processor_test.go +++ b/pkg/worker/list_processor_test.go @@ -5,11 +5,12 @@ package worker import ( "context" "errors" - "log/slog" "math/rand" "sync" "testing" + "golang.org/x/exp/slog" + "git.sr.ht/~gabrielgio/img/pkg/testkit" ) |