You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature
I would like mg.F to support variadic functions.
What problem does this feature address?
The main use case would be to pass sh.Run to it, as such: mg.F(sh.Run, "go", "test", "./...")
I think this should be possible with some work. mg.F(sh.Run, "go", []string{"test", "./..."}) would also be ok, or another function instead of mg.F.
Right now there's a lot of single-line functions that need to be added that are then passed to mg.Deps. As pointed out in #400, it's possible to use inline function literals for this, but those are also quite verbose. Also they might run the same command multiple times, as the arguments and actual function are not part of the deps check for those literals.
Having sh.Run directly in mg.Deps improve readability and simplifies the magefile writing.
Additional context
This occurred to me during the discussion in #400 where I had a different syntax for the same thing.
The text was updated successfully, but these errors were encountered:
Allows to pass sh.Run to mg.F as such:
mg.Deps(
mg.F(sh.Run, "go", "test", "./..."),
)
This improves the magefile by removing some of the one-liner functions
that you might end up with that are only used through mg.Deps.
Resolvesmagefile#401.
Allows to pass sh.Run to mg.F as such:
mg.Deps(
mg.F(sh.Run, "go", "test", "./..."),
)
This improves the magefile by removing some of the one-liner functions
that you might end up with that are only used through mg.Deps.
Resolvesmagefile#401.
Allows to pass sh.Run to mg.F as such:
mg.Deps(
mg.F(sh.Run, "go", "test", "./..."),
)
This improves the magefile by removing some of the one-liner functions
that you might end up with that are only used through mg.Deps.
Resolves#401.
Describe the feature
I would like
mg.F
to support variadic functions.What problem does this feature address?
The main use case would be to pass sh.Run to it, as such:
mg.F(sh.Run, "go", "test", "./...")
I think this should be possible with some work.
mg.F(sh.Run, "go", []string{"test", "./..."})
would also be ok, or another function instead ofmg.F
.Right now there's a lot of single-line functions that need to be added that are then passed to mg.Deps. As pointed out in #400, it's possible to use inline function literals for this, but those are also quite verbose. Also they might run the same command multiple times, as the arguments and actual function are not part of the deps check for those literals.
Having sh.Run directly in mg.Deps improve readability and simplifies the magefile writing.
Additional context
This occurred to me during the discussion in #400 where I had a different syntax for the same thing.
The text was updated successfully, but these errors were encountered: