Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Commit

Permalink
🆕 增加版本信息
Browse files Browse the repository at this point in the history
  • Loading branch information
perrornet committed Jan 16, 2022
1 parent c9f3ced commit e14e752
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/miner-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ var (
offlineTime = flag.Int64("offline", 60*4, "掉线多少秒之后, 发送微信通知")
)

var (
// build 时加入
gitHash string
gitCommit string
buildTime string
goVersion string
)
var (
reqeustUrls = []string{
"https://www.baidu.com/",
Expand Down Expand Up @@ -205,6 +212,17 @@ A:

func main() {
flag.Parse()
fmt.Println("版本信息: ")
fmt.Printf("git commit hash: %s\n", gitHash)
fmt.Printf("git commit message: %s\n", gitCommit)
if buildTime != "" {
t, err := time.Parse(time.ANSIC+" -0700", buildTime)
if err == nil {
fmt.Printf("build time: %s\n", t.Format("2006-01-02 15:04:05"))
}
}
fmt.Printf("golang version: %s\n", goVersion)

if *debug {
pkg.InitLog(zapcore.DebugLevel, *logFile)
}
Expand Down

0 comments on commit e14e752

Please sign in to comment.