forked from princjef/gomarkdoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
magefile.go
52 lines (42 loc) · 1.19 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
//+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.40.1",
"https://github.com/golangci/golangci-lint/releases/download/v{{.Version}}/golangci-lint-{{.Version}}-{{.GOOS}}-{{.GOARCH}}{{.ArchiveExt}}",
))
func Lint() error {
if err := linter.Ensure(); err != nil {
return err
}
return linter.Command(`run`).Run()
}
func Generate() error {
return shellcmd.Command(`go generate .`).Run()
}
func Doc() error {
return shellcmd.RunAll(
`go run ./cmd/gomarkdoc .`,
`go run ./cmd/gomarkdoc --header "" ./lang/...`,
`go run ./cmd/gomarkdoc --header "" ./format/...`,
`go run ./cmd/gomarkdoc --header "" ./cmd/...`,
)
}
func DocVerify() error {
return shellcmd.RunAll(
`go run ./cmd/gomarkdoc -c .`,
`go run ./cmd/gomarkdoc -c --header "" ./lang/...`,
`go run ./cmd/gomarkdoc -c --header "" ./format/...`,
`go run ./cmd/gomarkdoc -c --header "" ./cmd/...`,
)
}
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()
}