增加版本显示
This commit is contained in:
@@ -12,6 +12,13 @@ import (
|
||||
"github.com/goccy/go-yaml"
|
||||
)
|
||||
|
||||
// 由 install.sh 编译时通过 -ldflags -X 注入
|
||||
var (
|
||||
GitVersion = "dev"
|
||||
GitCommit = "unknown"
|
||||
BuildTime = "unknown"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
fmt.Println("OPS Backend Service started")
|
||||
@@ -101,6 +108,11 @@ func main() {
|
||||
c.Abort()
|
||||
})
|
||||
|
||||
// 将编译注入的版本信息传给 routers 包
|
||||
routers.GitVersion = GitVersion
|
||||
routers.GitCommit = GitCommit
|
||||
routers.BuildTime = BuildTime
|
||||
|
||||
// API路由
|
||||
routers.ApiRoot(r.Group("/api"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user