Skip to content

feat: Allow passing pointer arguments through mg.F#553

Open
fasmat wants to merge 1 commit into
magefile:masterfrom
fasmat:allow-flags-dependent-tasks
Open

feat: Allow passing pointer arguments through mg.F#553
fasmat wants to merge 1 commit into
magefile:masterfrom
fasmat:allow-flags-dependent-tasks

Conversation

@fasmat
Copy link
Copy Markdown

@fasmat fasmat commented Apr 30, 2026

With this change it is possible to use a target with flags / optional arguments in a mg.Deps or mg.SerialDeps definition through the use of mg.F:

func DependencyTarget(required string, optional *int) error {
   // ...
}

func MainTarget() error {
  var i = new(int)
  *i = 5
  mg.Deps(
    mg.F(DependencyTarget, "required", i)
  )

  // ...
}

or (since go 1.26)

func MainTarget() error {
  mg.Deps(
    mg.F(DependencyTarget, "required", new(5))
  )
  // ...
}

@fasmat fasmat changed the title Allow passing pointer arguments through mg.F feat: Allow passing pointer arguments through mg.F Apr 30, 2026
@fasmat fasmat force-pushed the allow-flags-dependent-tasks branch from 4d79dad to 1bafdca Compare April 30, 2026 17:54
@fasmat fasmat force-pushed the allow-flags-dependent-tasks branch from 1bafdca to f62506c Compare April 30, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant