-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.go
43 lines (33 loc) · 839 Bytes
/
build.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
package main
import (
"fmt"
"io/ioutil"
"strings"
"github.com/ProtossGenius/SureMoonNet/basis/smn_err"
"github.com/ProtossGenius/SureMoonNet/basis/smn_exec"
)
func check(err error) {
smn_err.DftOnErr(err)
}
func main() {
fmt.Println("Start build.go")
defer fmt.Println("Finish build.go")
scriptsPath := "./build-scrips/"
hasError := false
fileInfos, err := ioutil.ReadDir(scriptsPath)
check(err)
for _, info := range fileInfos {
if info.IsDir() || !strings.HasSuffix(info.Name(), ".go") {
continue
}
fmt.Println("running build-script: ", info.Name(), "......")
err = smn_exec.EasyDirExec("./", "go", "run", scriptsPath+info.Name())
if err != nil {
fmt.Println("Error when run ", info.Name(), ", error is : ", err.Error())
hasError = true
}
}
if hasError {
panic("some error happened.")
}
}