-
Notifications
You must be signed in to change notification settings - Fork 3
/
magefile.go
53 lines (42 loc) · 1.11 KB
/
magefile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//+build mage
package main
import (
"github.com/princjef/mageutil/bintool"
"github.com/princjef/mageutil/shellcmd"
)
var (
linter = bintool.Must(bintool.New(
"golangci-lint{{.BinExt}}",
"1.41.1",
"https://github.com/golangci/golangci-lint/releases/download/v{{.Version}}/golangci-lint-{{.Version}}-{{.GOOS}}-{{.GOARCH}}{{.ArchiveExt}}",
))
documenter = bintool.Must(bintool.New(
"gomarkdoc{{.BinExt}}",
"0.2.1",
"https://github.com/princjef/gomarkdoc/releases/download/v{{.Version}}/gomarkdoc_{{.Version}}_{{.GOOS}}_{{.GOARCH}}{{.ArchiveExt}}",
))
)
func Lint() error {
if err := linter.Ensure(); err != nil {
return err
}
return linter.Command("run").Run()
}
func Doc() error {
if err := documenter.Ensure(); err != nil {
return err
}
return documenter.Command("./...").Run()
}
func DocVerify() error {
if err := documenter.Ensure(); err != nil {
return err
}
return documenter.Command("-c ./...").Run()
}
func Test() error {
return shellcmd.Command("go test -coverprofile=coverage.out ./...").Run()
}
func Coverage() error {
return shellcmd.Command("go tool cover -html=coverage.out").Run()
}