Last active
January 24, 2021 01:34
-
-
Save carolynvs/b82a17580d4c50abc38529ee8fdc79ac to your computer and use it in GitHub Desktop.
example magefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// +build mage | |
package main | |
import ( | |
"github.com/carolynvs/magex/pkg" | |
"github.com/magefile/mage/mg" | |
"github.com/magefile/mage/sh" | |
) | |
// Default target to run when none is specified | |
// If not set, running mage will list available targets | |
var Default = Build | |
// Compile and lint the cli | |
func Build() error { | |
mg.Deps(Lint) | |
return sh.RunV("go", "build", "./...") | |
} | |
// nit the hell outta my code | |
func Lint() error { | |
mg.Deps(EnsureGoLint) | |
return sh.RunV("golint", "./...") | |
} | |
// Install golint if needed | |
func EnsureGoLint() error { | |
return pkg.EnsurePackage("golang.org/x/lint/golint", "") | |
} | |
// Install Mage if necessary | |
func EnsureMage() error { | |
return pkg.EnsureMage("v1.11.0") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment