1
0
mirror of https://github.com/go-task/task.git synced 2025-02-09 13:47:06 +02:00

Refactor: Use early return

This commit is contained in:
Andrey Nering 2022-11-02 10:23:19 -03:00
parent fd71dfda6a
commit a990ffe53d

View File

@ -91,21 +91,23 @@ func (e *Executor) readTaskfile() error {
func (e *Executor) setupFuzzyModel() {
if e.Taskfile != nil {
model := fuzzy.NewModel()
model.SetThreshold(1) // because we want to build grammar based on every task name
var words []string
for taskName := range e.Taskfile.Tasks {
words = append(words, taskName)
for _, task := range e.Taskfile.Tasks {
words = append(words, task.Aliases...)
}
}
model.Train(words)
e.fuzzyModel = model
return
}
model := fuzzy.NewModel()
model.SetThreshold(1) // because we want to build grammar based on every task name
var words []string
for taskName := range e.Taskfile.Tasks {
words = append(words, taskName)
for _, task := range e.Taskfile.Tasks {
words = append(words, task.Aliases...)
}
}
model.Train(words)
e.fuzzyModel = model
}
func (e *Executor) setupTempDir() error {