🔧 Update Go version in go.mod and enhance build process with versioning information. Modify Makefile and Taskfile to inject build metadata (version, commit, build time) into the binary. Improve README with instructions for custom version builds and document new build info features. Add benchmarks for message parsing and processing to improve performance testing capabilities.

This commit is contained in:
windyboy
2025-11-18 14:15:58 +08:00
parent 7f44b5389d
commit 06fc9cb9e0
27 changed files with 3009 additions and 55 deletions
+12 -1
View File
@@ -3,6 +3,14 @@ BUILD_DIR ?= bin
BINARY := $(BUILD_DIR)/receiver
CMD := ./cmd/main
GO_ENV ?= dev
VERSION ?= dev
# Build info variables
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
BUILD_TIME := $(shell printf 'package main\nimport ("fmt"\n"time")\nfunc main() { fmt.Print(time.Now().UTC().Format(time.RFC3339)) }' | go run -)
LDFLAGS := -X 'caatsm/internal/infra/buildinfo.Version=$(VERSION)' \
-X 'caatsm/internal/infra/buildinfo.Commit=$(GIT_COMMIT)' \
-X 'caatsm/internal/infra/buildinfo.BuiltAt=$(BUILD_TIME)'
# Default target
.PHONY: all
@@ -12,7 +20,10 @@ all: build ## Build the application
build: ## Build the receiver binary
@mkdir -p $(BUILD_DIR)
@echo "Building receiver..."
@go build -o $(BINARY) $(CMD)
@echo " Version: $(VERSION)"
@echo " Commit: $(GIT_COMMIT)"
@echo " Built: $(BUILD_TIME)"
@go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(CMD)
.PHONY: run
run: run-dev ## Alias for run-dev