Open whiterm opened 2 years ago
Ooh crap, I think I see the problem. If test1 runs and errors out, it's still marked as "run", so test3 sees that it doesn't need to run test1 and assumes it had succeeded. Instead we need to mark test1 as a failure so that if anyone else tries to run it, they fail out.
I think you are right. I just changed the test code a little bit. And now the bug can be reproduced at every run
// +build mage
package main
import (
"fmt"
"time"
"github.com/magefile/mage/mg"
)
func Test1() error {
fmt.Println("execute test1")
return fmt.Errorf("error test1")
}
func Test2() error {
mg.Deps(Test1)
fmt.Println("execute test2")
return nil
}
func Test3() error {
time.Sleep(time.Second)
mg.Deps(Test2)
fmt.Println("execute test3")
return nil
}
func Test4() error {
mg.Deps(Test1, Test2, Test3)
fmt.Println("execute test4")
return nil
}
To reproduce this bug, it was necessary to run
go run mage.go test4
several times, because this error is floatingOutput:
test3
target is not expected to run