refactor(version): extract version formatting helpers and improve build info display

Extract formatVersion() and formatBuildInfo() helper functions to reduce code duplication between printVersion() and statusCmd(). Update git commit default value to "dev" in Makefile for consistency with version handling. Update documentation for QQ and DingTalk chat integration in Japanese README.
This commit is contained in:
yinwm
2026-02-13 19:56:31 +08:00
parent 3c2e467324
commit 92490feff0
3 changed files with 96 additions and 63 deletions

View File

@@ -8,7 +8,7 @@ MAIN_GO=$(CMD_DIR)/main.go
# Version
VERSION?=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
GIT_COMMIT=$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo "unknown")
GIT_COMMIT=$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo "dev")
BUILD_TIME=$(shell date +%FT%T%z)
GO_VERSION=$(shell $(GO) version | awk '{print $$3}')
LDFLAGS=-ldflags "-X main.version=$(VERSION) -X main.gitCommit=$(GIT_COMMIT) -X main.buildTime=$(BUILD_TIME) -X main.goVersion=$(GO_VERSION)"