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 · 2 comments · May be fixed by #473
Open

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

opensource21 opened this issue Jun 9, 2023 · 2 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
@marene
Copy link

marene commented Nov 21, 2024

This enhancement would be a great quality of life improvement, but the MR associated to it seems to have stalled: is there any reason why, and is there something that could be done to get it approved (I did not see any discussion about it in the mage channel in the gophers slack, but maybe I missed it)?
I'd be more than willing to re-create an up-to-date MR if @opensource21 does not have the time to rebase their branch 👍

@opensource21
Copy link
Author

I can make the rebase, but without any feedback it looks like waste of time.

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.

2 participants