mage
mage copied to clipboard
Enhancement: Add function-name to error at Deps
Describe the feature
If you run multiple targets with mg.Deps(a, b, c)
and a and b throws an error, it difficult to get the context.
What problem does this feature address? It's easier to find the context of the error.
Additional context
func Test() error {
mg.Deps(a, b, c)
fmt.Println("Test")
return nil
}
func a() error {
duration, _ := time.ParseDuration("1s")
time.Sleep(duration)
fmt.Println("a")
return errors.New("a-err")
}
func b() error {
duration, _ := time.ParseDuration("2s")
time.Sleep(duration)
fmt.Println("b")
return errors.New("b-err")
}
func c() {
duration, _ := time.ParseDuration("5s")
time.Sleep(duration)
fmt.Println("c")
}
produced
Running target: Test
Running dependency: a
Running dependency: c
Running dependency: b
a
b
c
Error: a-err
b-err
wanted
niels@lapli104:/mnt/seu/sandboxes/git_k5s/technical-base/devcluster$ mage -v Test
Running target: Test
Running dependency: c
Running dependency: a
Running dependency: b
a
b
c
Error: main.a: a-err
main.b: b-err