Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add function-name to error at Deps #472

Open
opensource21 opened this issue Jun 9, 2023 · 0 comments · May be fixed by #473
Open

Enhancement: Add function-name to error at Deps #472

opensource21 opened this issue Jun 9, 2023 · 0 comments · May be fixed by #473

Comments

@opensource21
Copy link

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
@opensource21 opensource21 linked a pull request Jun 9, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant