chore: fix drivers not import

pull/1604/head
Noah Hsu 2022-08-07 13:23:15 +08:00
parent 0df3473337
commit 5b40254e3b
4 changed files with 8 additions and 7 deletions

View File

@ -2,12 +2,13 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/alist-org/alist/v3/cmd/flags" "github.com/alist-org/alist/v3/cmd/flags"
_ "github.com/alist-org/alist/v3/drivers"
"github.com/alist-org/alist/v3/internal/conf" "github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/server" "github.com/alist-org/alist/v3/server"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )

View File

@ -6,9 +6,9 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/alist-org/alist/v3/internal/conf"
"os" "os"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )

View File

@ -17,7 +17,7 @@ func init() {
TimestampFormat: "2006-01-02 15:04:05", TimestampFormat: "2006-01-02 15:04:05",
FullTimestamp: true, FullTimestamp: true,
}) })
logrus.SetLevel(logrus.DebugLevel) // logrus.SetLevel(logrus.DebugLevel)
} }
func Log() { func Log() {

View File

@ -1,13 +1,13 @@
package operations package operations
import ( import (
"github.com/alist-org/alist/v3/internal/conf"
"reflect" "reflect"
"strings" "strings"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/driver" "github.com/alist-org/alist/v3/internal/driver"
"github.com/pkg/errors" "github.com/pkg/errors"
log "github.com/sirupsen/logrus"
) )
type New func() driver.Driver type New func() driver.Driver
@ -16,7 +16,7 @@ var driverNewMap = map[string]New{}
var driverItemsMap = map[string]driver.Items{} var driverItemsMap = map[string]driver.Items{}
func RegisterDriver(config driver.Config, driver New) { func RegisterDriver(config driver.Config, driver New) {
log.Infof("register driver: [%s]", config.Name) // log.Infof("register driver: [%s]", config.Name)
registerDriverItems(config, driver().GetAddition()) registerDriverItems(config, driver().GetAddition())
driverNewMap[config.Name] = driver driverNewMap[config.Name] = driver
} }
@ -42,7 +42,7 @@ func GetDriverItemsMap() map[string]driver.Items {
} }
func registerDriverItems(config driver.Config, addition driver.Additional) { func registerDriverItems(config driver.Config, addition driver.Additional) {
log.Debugf("addition of %s: %+v", config.Name, addition) // log.Debugf("addition of %s: %+v", config.Name, addition)
tAddition := reflect.TypeOf(addition) tAddition := reflect.TypeOf(addition)
mainItems := getMainItems(config) mainItems := getMainItems(config)
additionalItems := getAdditionalItems(tAddition, config.DefaultRoot) additionalItems := getAdditionalItems(tAddition, config.DefaultRoot)