1
0
mirror of https://github.com/go-task/task.git synced 2025-11-27 22:38:20 +02:00

Fixes panic on task --list

Fixes #99
This commit is contained in:
Andrey Nering
2018-03-11 14:39:40 -03:00
parent 5649f75a8d
commit 120d0be84c
4 changed files with 17 additions and 16 deletions

11
task.go
View File

@@ -52,10 +52,6 @@ type Executor struct {
// Run runs Task
func (e *Executor) Run(calls ...taskfile.Call) error {
if err := e.setup(); err != nil {
return err
}
// check if given tasks exist
for _, c := range calls {
if _, ok := e.Taskfile.Tasks[c.Task]; !ok {
@@ -77,7 +73,12 @@ func (e *Executor) Run(calls ...taskfile.Call) error {
return nil
}
func (e *Executor) setup() error {
// Setup setups Executor's internal state
func (e *Executor) Setup() error {
if err := e.readTaskfile(); err != nil {
return err
}
v, err := semver.NewVersion(e.Taskfile.Version)
if err != nil {
return fmt.Errorf(`task: could not parse taskfile version "%s": %v`, e.Taskfile.Version, err)