mirror of
https://github.com/TECHNOFAB11/powerproto.git
synced 2026-02-02 09:25:07 +01:00
chore(*): format
Signed-off-by: storyicon <yuanchao@bilibili.com>
This commit is contained in:
parent
3bc2cede39
commit
dc1e825e2b
16 changed files with 233 additions and 24 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -71,4 +71,3 @@ func LoadConfig(filename string, pointer interface{}) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue