Mage release v1.11.0 - Argument support!

60 views
Skip to first unread message

Nate Finch

unread,
Dec 29, 2020, 12:40:42 AM12/29/20
to golang-nuts

Mage v1.11.0 supports taking positional arguments for targets that have arguments of type int, bool, string, or time.Duration. For example, if your magefile contains this target:

func Build(what string) { 
    fmt.Printf("building the %s...\n", what) 
}

you can run it by running

$ mage build server 
building the server...

You can also use functions that have those same types of arguments as dependencies by using the mg.F function:

func Deploy(what string) { 
     mg.Deps(mg.F(Build, what)) 
     fmt.Printf("deploying the %s...\n") 

$ mage deploy server 
building the server... 
Reply all
Reply to author
Forward
0 new messages