Set build hash and pipeline link through LDFlags

Add custom command values to config
This commit is contained in:
Michał Gdula 2025-04-24 19:32:32 +01:00
parent eb50802d1e
commit a0bb37fc06
5 changed files with 36 additions and 21 deletions

View file

@ -5,7 +5,6 @@ import (
"runtime"
"runtime/debug"
"strings"
"time"
"github.com/Fluffy-Bean/lynxie/app"
"github.com/Fluffy-Bean/lynxie/utils"
@ -21,7 +20,8 @@ func registerDebug(a *app.App) app.Callback {
buildTags := "-"
goVersion := strings.TrimPrefix(runtime.Version(), "go")
gcCount := runtime.MemStats{}.NumGC
localTime := time.Now().Local().Format("2006-01-02 15:04:05")
buildHash, _ := a.Config.CommandExtras["debug_build-hash"]
buildPipeline, _ := a.Config.CommandExtras["debug_build-pipeline"]
latency := h.Session.HeartbeatLatency().Milliseconds()
info, _ := debug.ReadBuildInfo()
@ -57,8 +57,8 @@ func registerDebug(a *app.App) app.Callback {
Inline: false,
},
{
Name: "Local Time",
Value: localTime,
Name: "Build Hash",
Value: fmt.Sprintf("[%s](%s)", buildHash, buildPipeline),
Inline: false,
},
{