mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
mage: Restore -v behaviour
This commit is contained in:
parent
a8e9f8389a
commit
71597bd1ad
1 changed files with 15 additions and 15 deletions
30
magefile.go
30
magefile.go
|
@ -159,31 +159,19 @@ func testGoFlags() string {
|
||||||
// Note that we don't run with the extended tag. Currently not supported in 32 bit.
|
// Note that we don't run with the extended tag. Currently not supported in 32 bit.
|
||||||
func Test386() error {
|
func Test386() error {
|
||||||
env := map[string]string{"GOARCH": "386", "GOFLAGS": testGoFlags()}
|
env := map[string]string{"GOARCH": "386", "GOFLAGS": testGoFlags()}
|
||||||
output, err := sh.OutputWith(env, goexe, "test", "./...")
|
return runCmd(env, goexe, "test", "./...")
|
||||||
if err != nil {
|
|
||||||
fmt.Printf(output)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run tests
|
// Run tests
|
||||||
func Test() error {
|
func Test() error {
|
||||||
env := map[string]string{"GOFLAGS": testGoFlags()}
|
env := map[string]string{"GOFLAGS": testGoFlags()}
|
||||||
output, err := sh.OutputWith(env, goexe, "test", "./...", "-tags", buildTags())
|
return runCmd(env, goexe, "test", "./...", "-tags", buildTags())
|
||||||
if err != nil {
|
|
||||||
fmt.Printf(output)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run tests with race detector
|
// Run tests with race detector
|
||||||
func TestRace() error {
|
func TestRace() error {
|
||||||
env := map[string]string{"GOFLAGS": testGoFlags()}
|
env := map[string]string{"GOFLAGS": testGoFlags()}
|
||||||
output, err := sh.OutputWith(env, goexe, "test", "-race", "./...", "-tags", buildTags())
|
return runCmd(env, goexe, "test", "-race", "./...", "-tags", buildTags())
|
||||||
if err != nil {
|
|
||||||
fmt.Printf(output)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run gofmt linter
|
// Run gofmt linter
|
||||||
|
@ -319,6 +307,18 @@ func TestCoverHTML() error {
|
||||||
return sh.Run(goexe, "tool", "cover", "-html="+coverAll)
|
return sh.Run(goexe, "tool", "cover", "-html="+coverAll)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func runCmd(env map[string]string, cmd string, args ...string) error {
|
||||||
|
if mg.Verbose() {
|
||||||
|
return sh.RunWith(env, cmd, args...)
|
||||||
|
}
|
||||||
|
output, err := sh.OutputWith(env, cmd, args...)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprint(os.Stderr, output)
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func isGoLatest() bool {
|
func isGoLatest() bool {
|
||||||
return strings.Contains(runtime.Version(), "1.12")
|
return strings.Contains(runtime.Version(), "1.12")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue