forked from jiang4920/jd_seckill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
39 lines (33 loc) · 800 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
package main
import (
"github.com/Albert-Zhan/httpc"
"github.com/unknwon/goconfig"
"github.com/ztino/jd_seckill/cmd"
"github.com/ztino/jd_seckill/common"
"github.com/ztino/jd_seckill/log"
"os"
"runtime"
)
func init() {
//日志初始化
if !common.IsDir("./logs/") {
_ = os.Mkdir("./logs/", 0777)
}
//客户端设置初始化
common.Client=httpc.NewHttpClient()
common.CookieJar=httpc.NewCookieJar()
common.Client.SetCookieJar(common.CookieJar)
//配置文件初始化
confFile:="./conf.ini"
var err error
if common.Config,err=goconfig.LoadConfigFile(confFile);err!=nil {
log.Println("配置文件不存在,程序退出")
os.Exit(0)
}
//抢购状态管道
common.SeckillStatus=make(chan bool)
}
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
cmd.Execute()
}