generated from templates/go-generic
Dan Anglin
a0e3ee8a6f
Add a landing page for the Flow Platform. The landing page is a linktree-styled static page made with Go, HTML and CSS.
56 lines
952 B
Go
56 lines
952 B
Go
//go:build mage
|
|
// +build mage
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/magefile/mage/sh"
|
|
)
|
|
|
|
var Default = Build
|
|
|
|
var binary = "landing"
|
|
|
|
// Test run the go tests.
|
|
// To enable verbose mode set GO_TEST_VERBOSE=1.
|
|
// To enable coverage mode set GO_TEST_COVER=1.
|
|
func Test() error {
|
|
goTest := sh.RunCmd("go", "test")
|
|
|
|
args := []string{"./..."}
|
|
|
|
if os.Getenv("GO_TEST_VERBOSE") == "1" {
|
|
args = append(args, "-v")
|
|
}
|
|
|
|
if os.Getenv("GO_TEST_COVER") == "1" {
|
|
args = append(args, "-cover")
|
|
}
|
|
|
|
return goTest(args...)
|
|
}
|
|
|
|
// Lint runs golangci-lint against the code.
|
|
func Lint() error {
|
|
return sh.RunV("golangci-lint", "run", "--color", "always")
|
|
}
|
|
|
|
// Build build the executable.
|
|
func Build() error {
|
|
return sh.Run("go", "build", "-o", binary, ".")
|
|
}
|
|
|
|
// Clean clean the workspace.
|
|
func Clean() error {
|
|
if err := sh.Rm(binary); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := sh.Run("go", "clean", "./..."); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|