feat: 项目初始化

This commit is contained in:
2025-12-03 23:29:51 +08:00
commit 016c44618b
14 changed files with 466 additions and 0 deletions

23
Makefile Normal file
View File

@@ -0,0 +1,23 @@
APP_NAME = netctl
SRC = .
OUTPUT = ./bin/$(APP_NAME).exe
GO = go
# 获取 Git commit
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
# 获取当前时间 UTC
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
.PHONY: build run clean
# 编译命令
build:
$(GO) build -ldflags "-X 'netcli/cmd.Version=1.0.0' -X 'netcli/cmd.Commit=$(GIT_COMMIT)' -X 'netcli/cmd.BuildTime=$(BUILD_TIME)'" -o $(OUTPUT) $(SRC)
# 直接运行
run:
$(GO) run -ldflags "-X 'netcli/cmd.Version=1.0.0' -X 'netcli/cmd.Commit=$(GIT_COMMIT)' -X 'netcli/cmd.BuildTime=$(BUILD_TIME)'" $(SRC)
# 清理编译文件
clean:
rm -f $(OUTPUT)