1
0
mirror of https://github.com/magefile/mage.git synced 2026-10-28 19:17:25 +03:00
Files
mage/mg/example_test.go
Nate Finch 3594347101 Set up linter (#539)
* Set up linter

Add .golangci.toml configuration file for linter settings.
2026-03-12 07:54:31 -04: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"))
}