This repository has been archived by the owner on Dec 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmagefile.go
85 lines (71 loc) · 1.62 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//+build mage
package main
import (
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
"log"
)
// TODO: Use Test() later
// Uses go fmt to format all our modules
func Format() {
log.Println("Running format")
sh.RunV("go", "fmt", "./...")
}
// Installs our formatting deps
func InstallDeps() {
log.Println("Installing deps")
sh.Run(
"go", "get", "github.com/fzipp/gocyclo",
"github.com/gordonklaus/ineffassign", "github.com/client9/misspell",
"golang.org/x/lint/golint",
)
}
// Runs the linting process
func Lint() {
log.Println("Running lint")
sh.RunV("go", "vet", "./...")
sh.RunV(
"gocyclo", "-over", "15", "pkg", "logger", "trains", "update",
"utils", "ws", "defines", "client",
)
sh.RunV("golint", "./...")
sh.RunV("ineffassign", "./")
sh.RunV("misspell", "-w", "./")
}
// Cleans sysups binary up
func Clean() {
log.Println("Running clean")
sh.RunV("go", "clean")
sh.RunV("rm", "-f", "./sysup")
}
// Builds sysup and run it from this directory
func Run() {
log.Println("Running run")
mg.Deps(Build)
sh.Run("./sysup")
}
// Installs sysup to GOPATH
func Install() {
log.Println("Running install")
sh.RunV("go", "install")
}
// Run our tests (nonfunctional)
func Test() {
log.Println("Running test")
sh.RunV("go", "test", "-v", "./...")
}
// Builds sysup and install it
func All() {
log.Println("Making all")
mg.Deps(Build, Install)
}
// Builds sysup
func Build() {
log.Println("Making build")
sh.RunV("go", "build", "-o", "sysup", "-v")
}
// Standard development build process (format, install deps, lint, build)
func Dev() {
log.Println("Making dev")
mg.Deps(Format, InstallDeps, Lint, Build)
}