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

changed cyclic dep detection

since interpolation can be used, detection should be a execution time,
and not before

now, to prevent infinite execution, there's a miximum of 100 calls per
task

closes #37
This commit is contained in:
Andrey Nering
2017-07-08 13:33:55 -03:00
parent fb4b0a187e
commit 2dd3564da1
6 changed files with 44 additions and 96 deletions

View File

@ -6,8 +6,6 @@ import (
)
var (
// ErrCyclicDepDetected is returned when a cyclic dependency was found in the Taskfile
ErrCyclicDepDetected = errors.New("task: cyclic dependency detected")
// ErrTaskfileAlreadyExists is returned on creating a Taskfile if one already exists
ErrTaskfileAlreadyExists = errors.New("task: A Taskfile already exists")
)
@ -61,3 +59,18 @@ type dynamicVarError struct {
func (err *dynamicVarError) Error() string {
return fmt.Sprintf(`task: Command "%s" in taskvars file failed: %s`, err.cmd, err.cause)
}
// MaximumTaskCallExceededError is returned when a task is called too
// many times. In this case you probably have a cyclic dependendy or
// infinite loop
type MaximumTaskCallExceededError struct {
task string
}
func (e *MaximumTaskCallExceededError) Error() string {
return fmt.Sprintf(
`task: maximum task call exceeded (%d) for task "%s": probably an cyclic dep or infinite loop`,
MaximumTaskCall,
e.task,
)
}