Skip to content

Commit

Permalink
fix args naming PreprocessingChain
Browse files Browse the repository at this point in the history
  • Loading branch information
kozmod committed Jun 3, 2023
1 parent 68554d4 commit cad0e6b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
18 changes: 9 additions & 9 deletions internal/exec/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ import (
)

type PreprocessingChain struct {
loaders []entity.Preprocessor
processors []entity.Executor
preprocessors []entity.Preprocessor
executors []entity.Executor
}

func NewPreprocessingChain(loaders []entity.Preprocessor, processors []entity.Executor) *PreprocessingChain {
func NewPreprocessingChain(preprocessors []entity.Preprocessor, executors []entity.Executor) *PreprocessingChain {
return &PreprocessingChain{
loaders: loaders,
processors: processors,
preprocessors: preprocessors,
executors: executors,
}
}

func (c *PreprocessingChain) Exec() error {
for i, loader := range c.loaders {
err := loader.Process()
for i, preprocessor := range c.preprocessors {
err := preprocessor.Process()
if err != nil {
return xerrors.Errorf("preload [%d]: %w", i, err)
}
}

for i, processor := range c.processors {
err := processor.Exec()
for i, executor := range c.executors {
err := executor.Exec()
if err != nil {
return xerrors.Errorf("execute proc [%d]: %w", i, err)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/factory/chain_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewExecutorChain(
})
}

var loaders []entity.Preprocessor
var preprocessors []entity.Preprocessor
for _, files := range conf.Files {
f := files
builders = append(builders,
Expand All @@ -53,7 +53,7 @@ func NewExecutorChain(
logger,
preprocess,
dryRun)
loaders = append(loaders, l...)
preprocessors = append(preprocessors, l...)
return executor, err
},
})
Expand Down Expand Up @@ -101,5 +101,5 @@ func NewExecutorChain(
executors = append(executors, e)
}

return exec.NewPreprocessingChain(loaders, executors), nil
return exec.NewPreprocessingChain(preprocessors, executors), nil
}
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ func main() {
flags.TemplateVars.Vars,
entity.TemplateFnsMap,
[]string{flags.MissingKey.String()},
).
Process(data)
).Process(data)
if err != nil {
logger.Fatalf(logFatalSuffixFn("preprocess raw config: "), err)
}
Expand Down

0 comments on commit cad0e6b

Please sign in to comment.