feat: add commit HASH to extra

This commit is contained in:
liruichen 2023-09-07 18:28:17 +08:00
parent 5049a57467
commit de9a3d2118

View File

@ -30,6 +30,7 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"testing" "testing"
"os/exec"
"{{.GlobalCoverVarImportPath}}/websocket" "{{.GlobalCoverVarImportPath}}/websocket"
@ -115,6 +116,14 @@ func register (host string) {
time.Sleep(waitDelay) time.Sleep(waitDelay)
continue continue
} }
cmd := exec.Command("git", "describe", "--abbrev=8", "--always")
output, err := cmd.Output()
if err != nil {
fmt.Println("git describe Error:", err)
}else{
version := string(output)
register_extra = register_extra + "_" + version
}
// 注册,直接将元信息放在 ws 地址中 // 注册,直接将元信息放在 ws 地址中
v := url.Values{} v := url.Values{}