1
0
mirror of https://github.com/go-task/task.git synced 2025-06-27 00:51:05 +02:00

Fix wrong error message beingg print when the file has a syntax error

Fixes #137
This commit is contained in:
Andrey Nering
2018-09-22 17:29:18 -03:00
parent 347fe87229
commit 08263c0597

View File

@ -14,9 +14,12 @@ import (
// Taskfile reads a Taskfile for a given directory // Taskfile reads a Taskfile for a given directory
func Taskfile(dir string) (*taskfile.Taskfile, error) { func Taskfile(dir string) (*taskfile.Taskfile, error) {
path := filepath.Join(dir, "Taskfile.yml") path := filepath.Join(dir, "Taskfile.yml")
if _, err := os.Stat(path); err != nil {
return nil, fmt.Errorf(`No Taskfile.yml found. Use "task --init" to create a new one`)
}
t, err := readTaskfile(path) t, err := readTaskfile(path)
if err != nil { if err != nil {
return nil, fmt.Errorf(`No Taskfile.yml found. Use "task --init" to create a new one`) return nil, err
} }
path = filepath.Join(dir, fmt.Sprintf("Taskfile_%s.yml", runtime.GOOS)) path = filepath.Join(dir, fmt.Sprintf("Taskfile_%s.yml", runtime.GOOS))