完善版本发布流程并处理会话失效场景

This commit is contained in:
Christ committed 2026-08-13 20:04:45 +08:00
1 parent 36798dcced
commit 1833020caf
52 files changed
+1129 -265

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
// Package version exposes build metadata injected by release builds.
package version
import "strings"
var (
Version = "dev"
Commit = "unknown"
BuildTime = "unknown"
)
// ShortCommit returns a compact commit identifier suitable for UI display.
func ShortCommit() string {
commit := strings.TrimSpace(Commit)
if len(commit) > 12 {
return commit[:12]
}
if commit == "" {
return "unknown"
}
return commit
}
+13
View File
@@ -0,0 +1,13 @@
package version
import "testing"
func TestShortCommit(t *testing.T) {
original := Commit
t.Cleanup(func() { Commit = original })
Commit = "0123456789abcdef"
if got := ShortCommit(); got != "0123456789ab" {
t.Fatalf("ShortCommit() = %q", got)
}
}