chore(*): format

Signed-off-by: storyicon <yuanchao@bilibili.com>
This commit is contained in:
storyicon 2021-07-22 00:58:28 +08:00
parent 3bc2cede39
commit dc1e825e2b
No known key found for this signature in database
GPG key ID: 245915D985F966CF
16 changed files with 233 additions and 24 deletions

View file

@ -290,7 +290,7 @@ func StepPostShell(ctx context.Context,
// Compile is used to compile proto files
func Compile(ctx context.Context, targets []string) error {
log := logger.NewDefault("compile")
log.SetLogLevel(logger.LevelError)
log.SetLogLevel(logger.LevelInfo)
if consts.IsDebugMode(ctx) {
log.SetLogLevel(logger.LevelDebug)
}

View file

@ -31,7 +31,7 @@ import (
// StepTidyConfig is used to tidy configs by proto file targets
func StepTidyConfig(ctx context.Context, targets []string) error {
log := logger.NewDefault("tidy")
log.SetLogLevel(logger.LevelError)
log.SetLogLevel(logger.LevelInfo)
if consts.IsDebugMode(ctx) {
log.SetLogLevel(logger.LevelDebug)
}
@ -72,7 +72,7 @@ func StepTidyConfig(ctx context.Context, targets []string) error {
return nil
}
// StepTidyConfig is used clean config
// StepTidyConfigFile is used clean config
// It will amend the 'latest' version to the latest version number in 'vx.y.z' format
func StepTidyConfigFile(ctx context.Context,
pluginManager pluginmanager.PluginManager,

View file

@ -51,10 +51,10 @@ func NewBasicActionManager(log logger.Logger) (*BasicActionManager, error) {
return &BasicActionManager{
Logger: log.NewLogger("actionmanager"),
actions: map[string]actions.ActionFunc{
"move": actions.ActionMove,
"move": actions.ActionMove,
"replace": actions.ActionReplace,
"remove": actions.ActionRemove,
"copy": actions.ActionCopy,
"remove": actions.ActionRemove,
"copy": actions.ActionCopy,
},
}, nil
}

View file

@ -36,7 +36,7 @@ type BasicCompilerManager struct {
configManager configmanager.ConfigManager
pluginManager pluginmanager.PluginManager
tree map[string]Compiler
tree map[string]Compiler
treeLock sync.RWMutex
}
@ -51,7 +51,7 @@ func NewCompilerManager(ctx context.Context,
return NewBasicCompilerManager(ctx, log, configManager, pluginManager)
}
// BasicCompilerManager is used to create basic CompilerManager
// NewBasicCompilerManager is used to create basic CompilerManager
func NewBasicCompilerManager(ctx context.Context,
log logger.Logger,
configManager configmanager.ConfigManager,

View file

@ -46,7 +46,7 @@ type BasicConfigManager struct {
treeLock sync.RWMutex
}
// New is used to create a basic ConfigManager
// NewBasicConfigManager is used to create a basic ConfigManager
func NewBasicConfigManager(log logger.Logger) (*BasicConfigManager, error) {
return &BasicConfigManager{
Logger: log.NewLogger("configmanager"),
@ -54,7 +54,7 @@ func NewBasicConfigManager(log logger.Logger) (*BasicConfigManager, error) {
}, nil
}
// GetCompiler is used to get config of specified proto file path
// GetConfig is used to get config of specified proto file path
func (b *BasicConfigManager) GetConfig(ctx context.Context, protoFilePath string) (configs.ConfigItem, error) {
possiblePath := configs.ListConfigPaths(filepath.Dir(protoFilePath))
for _, configFilePath := range possiblePath {

View file

@ -83,7 +83,7 @@ func LoadConfigs(path string) ([]*Config, error) {
return ret, nil
}
// Similar to LoadConfigs, but obtains the abstraction of the Config prototype structure
// LoadConfigItems is similar to LoadConfigs, but obtains the abstraction of the Config prototype structure
func LoadConfigItems(path string) ([]ConfigItem, error) {
data, err := LoadConfigs(path)
if err != nil {

View file

@ -28,7 +28,7 @@ type ConfigItem interface {
Config() *Config
}
// GetConfigs is used to generate Config from given config entity
// GetConfigItems is used to generate ConfigItem from given config entity
func GetConfigItems(data []*Config, path string) []ConfigItem {
ret := make([]ConfigItem, 0, len(data))
for i, item := range data {

View file

@ -110,7 +110,7 @@ func GetFilesWithExtRecursively(target string, targetExt string) ([]string, erro
return data, err
}
// GetFilesWithExtRecursively is used to list files with a specific suffix
// GetFilesWithExt is used to list files with a specific suffix
// expectExt should contain the prefix '.'
func GetFilesWithExt(dir string, targetExt string) ([]string, error) {
children, err := ioutil.ReadDir(dir)

View file

@ -58,6 +58,7 @@ type Config struct {
Level Level
}
// Level is the structure of log level
type Level struct {
Name string
Color color.Attribute
@ -65,6 +66,7 @@ type Level struct {
Writer io.Writer
}
// defines a set of log level
var (
LevelDebug = Level{Name: "debug", Color: color.FgWhite, Index: 0, Writer: os.Stdout}
LevelInfo = Level{Name: "info", Color: color.FgWhite, Index: 1, Writer: os.Stdout}

View file

@ -71,4 +71,3 @@ func LoadConfig(filename string, pointer interface{}) error {
return nil
}