1
0
mirror of https://github.com/magefile/mage.git synced 2026-10-24 06:19:18 +03:00
Files
mage/mg/example_test.go
Nate Finch aba395058b I guess arguments work now (#326)
* I guess arguments work now
* add mg.F
2020-12-28 23:58:26 -05:00

30 lines
633 B
Go

package mg_test
import (
"fmt"
"github.com/magefile/mage/mg"
)
func Example() {
// Deps will run each dependency exactly once, and will run leaf-dependencies before those
// functions that depend on them (if you put mg.Deps first in the function).
// Normal (non-serial) Deps runs all dependencies in goroutines, so which one finishes first is
// non-deterministic. Here we use SerialDeps here to ensure the example always produces the same
// output.
mg.SerialDeps(mg.F(Say, "hi"), Bark)
// output:
// hi
// woof
}
func Say(something string) {
fmt.Println(something)
}
func Bark() {
mg.Deps(mg.F(Say, "woof"))
}