-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.go
48 lines (42 loc) · 776 Bytes
/
main.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
/**
* main process
* Usage: wx-gateway[ -v]
* Rosbit Xu
*/
package main
import (
"wx-gateway/conf"
"os"
"fmt"
)
// variables set via go build -ldflags
var (
buildTime string
osInfo string
goInfo string
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "-v" {
ShowInfo("name", os.Args[0])
ShowInfo("build time", buildTime)
ShowInfo("os name", osInfo)
ShowInfo("compiler", goInfo)
return
}
if err := gwconf.CheckGlobalConf(); err != nil {
fmt.Printf("Failed to check conf: %v\n", err)
os.Exit(3)
return
}
gwconf.DumpConf()
if err := StartWxGateway(); err != nil {
fmt.Printf("%v\n", err)
os.Exit(4)
}
os.Exit(0)
}
func ShowInfo(prompt, info string) {
if info != "" {
fmt.Printf("%10s: %s\n", prompt, info)
}
}