From 6c4ffcffa51655383ecfb1c2148d88557b520de0 Mon Sep 17 00:00:00 2001 From: Daniel Sonck Date: Wed, 10 Jul 2024 00:24:04 +0200 Subject: [PATCH] chore: webdav: reorder imports --- webdav/.golangci.yml | 5 ----- webdav/cache/workspace_cache.go | 17 +++++++++-------- webdav/client/api_client.go | 7 ++++--- webdav/client/idp_client.go | 5 +++-- webdav/handler/handler.go | 3 ++- webdav/handler/method_copy.go | 5 +++-- webdav/handler/method_delete.go | 3 ++- webdav/handler/method_get.go | 10 ++++++---- webdav/handler/method_head.go | 3 ++- webdav/handler/method_mkcol.go | 5 +++-- webdav/handler/method_move.go | 7 ++++--- webdav/handler/method_propfind.go | 3 ++- webdav/handler/method_put.go | 12 +++++++----- webdav/helper/token.go | 3 ++- webdav/infra/redis.go | 6 ++++-- webdav/infra/s3.go | 8 +++++--- webdav/main.go | 11 +++++++---- 17 files changed, 65 insertions(+), 48 deletions(-) diff --git a/webdav/.golangci.yml b/webdav/.golangci.yml index 4b0aae34c..235f51c42 100644 --- a/webdav/.golangci.yml +++ b/webdav/.golangci.yml @@ -33,11 +33,6 @@ linters: - lll - gosec - funlen - - goimports - - gofmt - - gofumpt - - gci - - tagalign severity: default-severity: major diff --git a/webdav/cache/workspace_cache.go b/webdav/cache/workspace_cache.go index fb54a1876..773c7a2fc 100644 --- a/webdav/cache/workspace_cache.go +++ b/webdav/cache/workspace_cache.go @@ -12,6 +12,7 @@ package cache import ( "encoding/json" + "github.com/kouprlabs/voltaserve/webdav/infra" ) @@ -28,14 +29,14 @@ func NewWorkspaceCache() *WorkspaceCache { } type Workspace struct { - ID string `json:"id," gorm:"column:id;size:36"` - Name string `json:"name" gorm:"column:name;size:255"` - StorageCapacity int64 `json:"storageCapacity" gorm:"column:storage_capacity"` - RootID string `json:"rootId" gorm:"column:root_id;size:36"` - OrganizationID string `json:"organizationId" gorm:"column:organization_id;size:36"` - Bucket string `json:"bucket" gorm:"column:bucket;size:255"` - CreateTime string `json:"createTime" gorm:"column:create_time"` - UpdateTime *string `json:"updateTime,omitempty" gorm:"column:update_time"` + ID string `gorm:"column:id;size:36" json:"id"` + Name string `gorm:"column:name;size:255" json:"name"` + StorageCapacity int64 `gorm:"column:storage_capacity" json:"storageCapacity"` + RootID string `gorm:"column:root_id;size:36" json:"rootId"` + OrganizationID string `gorm:"column:organization_id;size:36" json:"organizationId"` + Bucket string `gorm:"column:bucket;size:255" json:"bucket"` + CreateTime string `gorm:"column:create_time" json:"createTime"` + UpdateTime *string `gorm:"column:update_time" json:"updateTime,omitempty"` } func (c *WorkspaceCache) Get(id string) (*Workspace, error) { diff --git a/webdav/client/api_client.go b/webdav/client/api_client.go index e0f41137a..4ab05fa73 100644 --- a/webdav/client/api_client.go +++ b/webdav/client/api_client.go @@ -15,14 +15,15 @@ import ( "encoding/json" "errors" "fmt" - "github.com/kouprlabs/voltaserve/webdav/config" - "github.com/kouprlabs/voltaserve/webdav/helper" - "github.com/kouprlabs/voltaserve/webdav/infra" "io" "net/http" "net/url" "os" "strings" + + "github.com/kouprlabs/voltaserve/webdav/config" + "github.com/kouprlabs/voltaserve/webdav/helper" + "github.com/kouprlabs/voltaserve/webdav/infra" ) const ( diff --git a/webdav/client/idp_client.go b/webdav/client/idp_client.go index 55186dd05..2ffc52843 100644 --- a/webdav/client/idp_client.go +++ b/webdav/client/idp_client.go @@ -15,12 +15,13 @@ import ( "encoding/json" "errors" "fmt" - "github.com/kouprlabs/voltaserve/webdav/config" - "github.com/kouprlabs/voltaserve/webdav/infra" "io" "net/http" "net/url" "strings" + + "github.com/kouprlabs/voltaserve/webdav/config" + "github.com/kouprlabs/voltaserve/webdav/infra" ) const ( diff --git a/webdav/handler/handler.go b/webdav/handler/handler.go index caa87ffd9..57dd7193e 100644 --- a/webdav/handler/handler.go +++ b/webdav/handler/handler.go @@ -11,10 +11,11 @@ package handler import ( + "net/http" + "github.com/kouprlabs/voltaserve/webdav/cache" "github.com/kouprlabs/voltaserve/webdav/client" "github.com/kouprlabs/voltaserve/webdav/infra" - "net/http" ) type Handler struct { diff --git a/webdav/handler/method_copy.go b/webdav/handler/method_copy.go index cafe39f4d..0d6647804 100644 --- a/webdav/handler/method_copy.go +++ b/webdav/handler/method_copy.go @@ -12,11 +12,12 @@ package handler import ( "fmt" + "net/http" + "path" + "github.com/kouprlabs/voltaserve/webdav/client" "github.com/kouprlabs/voltaserve/webdav/helper" "github.com/kouprlabs/voltaserve/webdav/infra" - "net/http" - "path" ) /* diff --git a/webdav/handler/method_delete.go b/webdav/handler/method_delete.go index ecb883145..81930281f 100644 --- a/webdav/handler/method_delete.go +++ b/webdav/handler/method_delete.go @@ -12,10 +12,11 @@ package handler import ( "fmt" + "net/http" + "github.com/kouprlabs/voltaserve/webdav/client" "github.com/kouprlabs/voltaserve/webdav/helper" "github.com/kouprlabs/voltaserve/webdav/infra" - "net/http" ) /* diff --git a/webdav/handler/method_get.go b/webdav/handler/method_get.go index d79866587..24f9a28c5 100644 --- a/webdav/handler/method_get.go +++ b/webdav/handler/method_get.go @@ -12,16 +12,18 @@ package handler import ( "fmt" - "github.com/google/uuid" - "github.com/kouprlabs/voltaserve/webdav/client" - "github.com/kouprlabs/voltaserve/webdav/helper" - "github.com/kouprlabs/voltaserve/webdav/infra" "io" "net/http" "os" "path/filepath" "strconv" "strings" + + "github.com/google/uuid" + + "github.com/kouprlabs/voltaserve/webdav/client" + "github.com/kouprlabs/voltaserve/webdav/helper" + "github.com/kouprlabs/voltaserve/webdav/infra" ) /* diff --git a/webdav/handler/method_head.go b/webdav/handler/method_head.go index 6be2bd8a9..c0c7885ae 100644 --- a/webdav/handler/method_head.go +++ b/webdav/handler/method_head.go @@ -12,10 +12,11 @@ package handler import ( "fmt" + "net/http" + "github.com/kouprlabs/voltaserve/webdav/client" "github.com/kouprlabs/voltaserve/webdav/helper" "github.com/kouprlabs/voltaserve/webdav/infra" - "net/http" ) /* diff --git a/webdav/handler/method_mkcol.go b/webdav/handler/method_mkcol.go index 191226d55..23222a26f 100644 --- a/webdav/handler/method_mkcol.go +++ b/webdav/handler/method_mkcol.go @@ -12,11 +12,12 @@ package handler import ( "fmt" + "net/http" + "path" + "github.com/kouprlabs/voltaserve/webdav/client" "github.com/kouprlabs/voltaserve/webdav/helper" "github.com/kouprlabs/voltaserve/webdav/infra" - "net/http" - "path" ) /* diff --git a/webdav/handler/method_move.go b/webdav/handler/method_move.go index eda6ad9c4..ba07964c1 100644 --- a/webdav/handler/method_move.go +++ b/webdav/handler/method_move.go @@ -12,12 +12,13 @@ package handler import ( "fmt" - "github.com/kouprlabs/voltaserve/webdav/client" - "github.com/kouprlabs/voltaserve/webdav/helper" - "github.com/kouprlabs/voltaserve/webdav/infra" "net/http" "path" "strings" + + "github.com/kouprlabs/voltaserve/webdav/client" + "github.com/kouprlabs/voltaserve/webdav/helper" + "github.com/kouprlabs/voltaserve/webdav/infra" ) /* diff --git a/webdav/handler/method_propfind.go b/webdav/handler/method_propfind.go index bd04cf55a..60c56f416 100644 --- a/webdav/handler/method_propfind.go +++ b/webdav/handler/method_propfind.go @@ -12,10 +12,11 @@ package handler import ( "fmt" + "net/http" + "github.com/kouprlabs/voltaserve/webdav/client" "github.com/kouprlabs/voltaserve/webdav/helper" "github.com/kouprlabs/voltaserve/webdav/infra" - "net/http" ) /* diff --git a/webdav/handler/method_put.go b/webdav/handler/method_put.go index a23d58d69..907b83d59 100644 --- a/webdav/handler/method_put.go +++ b/webdav/handler/method_put.go @@ -12,17 +12,19 @@ package handler import ( "fmt" - "github.com/google/uuid" - "github.com/kouprlabs/voltaserve/webdav/client" - "github.com/kouprlabs/voltaserve/webdav/helper" - "github.com/kouprlabs/voltaserve/webdav/infra" - "github.com/minio/minio-go/v7" "io" "net/http" "os" "path" "path/filepath" "strings" + + "github.com/google/uuid" + "github.com/minio/minio-go/v7" + + "github.com/kouprlabs/voltaserve/webdav/client" + "github.com/kouprlabs/voltaserve/webdav/helper" + "github.com/kouprlabs/voltaserve/webdav/infra" ) /* diff --git a/webdav/helper/token.go b/webdav/helper/token.go index d175e2b4d..73af6c0a2 100644 --- a/webdav/helper/token.go +++ b/webdav/helper/token.go @@ -11,8 +11,9 @@ package helper import ( - "github.com/kouprlabs/voltaserve/webdav/infra" "time" + + "github.com/kouprlabs/voltaserve/webdav/infra" ) func NewExpiry(token *infra.Token) time.Time { diff --git a/webdav/infra/redis.go b/webdav/infra/redis.go index 266ffcf27..d92ca0bd2 100644 --- a/webdav/infra/redis.go +++ b/webdav/infra/redis.go @@ -12,9 +12,11 @@ package infra import ( "context" - "github.com/kouprlabs/voltaserve/webdav/config" - "github.com/redis/go-redis/v9" "strings" + + "github.com/redis/go-redis/v9" + + "github.com/kouprlabs/voltaserve/webdav/config" ) type RedisManager struct { diff --git a/webdav/infra/s3.go b/webdav/infra/s3.go index 687e88143..e1c477899 100644 --- a/webdav/infra/s3.go +++ b/webdav/infra/s3.go @@ -14,11 +14,13 @@ import ( "bytes" "context" "errors" - "github.com/kouprlabs/voltaserve/webdav/config" - "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/credentials" "io" "strings" + + "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" + + "github.com/kouprlabs/voltaserve/webdav/config" ) type S3Manager struct { diff --git a/webdav/main.go b/webdav/main.go index 8a7b7403c..ae3f5f9cc 100644 --- a/webdav/main.go +++ b/webdav/main.go @@ -13,10 +13,6 @@ package main import ( "context" "fmt" - "github.com/kouprlabs/voltaserve/webdav/client" - "github.com/kouprlabs/voltaserve/webdav/handler" - "github.com/kouprlabs/voltaserve/webdav/helper" - "github.com/kouprlabs/voltaserve/webdav/infra" "log" "net/http" "os" @@ -25,7 +21,12 @@ import ( "time" "github.com/joho/godotenv" + + "github.com/kouprlabs/voltaserve/webdav/client" "github.com/kouprlabs/voltaserve/webdav/config" + "github.com/kouprlabs/voltaserve/webdav/handler" + "github.com/kouprlabs/voltaserve/webdav/helper" + "github.com/kouprlabs/voltaserve/webdav/infra" ) var ( @@ -90,6 +91,8 @@ func basicAuthMiddleware(next http.Handler, idpClient *client.IdPClient) http.Ha // @title Voltaserve WebDAV // @version 2.0.0 // @BasePath /v2 +// +// . func main() { if _, err := os.Stat(".env.local"); err == nil { if err := godotenv.Load(".env.local"); err != nil {