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:
@ -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))
|
||||||
|
Reference in New Issue
Block a user