重构:完成架构一致性整改与生命周期收口

This commit is contained in:
Christ committed 2026-08-18 14:05:08 +08:00
1 parent 55904cc409
commit 9eb6be2875
344 files changed
+15961 -13926

No files matched your search

+3 -3
View File
@@ -3,7 +3,7 @@ package version
import "strings"
// Version 保存Version,供当前处理流程使用
// Version 用于本次流程后续判断的Version
var (
Version = "dev"
Commit = "unknown"
@@ -11,9 +11,9 @@ var (
)
// ShortCommit returns a compact commit identifier suitable for UI display.
// ShortCommit 负责ShortCommit相关处理。
// ShortCommit 封装ShortCommit业务协调。
func ShortCommit() string {
// commit 保存commit,供当前处理流程使用
// commit 用于本次流程后续判断的commit
commit := strings.TrimSpace(Commit)
if len(commit) > 12 {
return commit[:12]
+3 -3
View File
@@ -2,14 +2,14 @@ package version
import "testing"
// TestShortCommit 负责TestShortCommit相关处理。
// TestShortCommit 封装TestShortCommit业务协调。
func TestShortCommit(t *testing.T) {
// original 保存original,供当前处理流程使用
// original 用于本次流程后续判断的original
original := Commit
t.Cleanup(func() { Commit = original })
Commit = "0123456789abcdef"
if // got 保存got,供当前处理流程使用
if // got 用于本次流程后续判断的got
got := ShortCommit(); got != "0123456789ab" {
t.Fatalf("ShortCommit() = %q", got)
}