From 52a210ed19ef72781e770b80175bad561fc5a161 Mon Sep 17 00:00:00 2001 From: xfy Date: Fri, 10 Apr 2026 16:55:47 +0800 Subject: [PATCH] =?UTF-8?q?chore(config):=20=E8=B0=83=E6=95=B4=20golangci-?= =?UTF-8?q?lint=20=E5=92=8C=20Makefile=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit golangci.yml: - 排除 lua 包的 revive stuttering 检查 - 配置 revive exported 规则禁用 stuttering 检查 Makefile: - 简化构建命令,移除冗余的 build 和 build-prod 区分 - 默认 build 使用最大性能优化构建 Co-Authored-By: Claude Opus 4.6 --- .golangci.yml | 13 ++++++++++++- Makefile | 19 ++----------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8803b58..7689647 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -117,6 +117,7 @@ linters: - wsl_v5 # whitespace v5 - zerologlint # zerolog 检查 + linters: exclusions: rules: - path: '_test\.go' @@ -127,6 +128,11 @@ linters: - path: 'internal/ssl/ocsp_test\.go' linters: - unparam + # 排除 revive 的 stuttering 检查(lua.LuaXxx 类型命名) + - path: 'internal/lua/' + text: "stutters" + linters: + - revive formatters: default: all @@ -153,4 +159,9 @@ linters-settings: rules: - name: unused-parameter severity: warning - disabled: false \ No newline at end of file + disabled: false + - name: exported + severity: warning + disabled: false + arguments: + - "disableStutteringCheck" \ No newline at end of file diff --git a/Makefile b/Makefile index 2305c8c..7b86659 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ BUILD_DIR := bin # 静态构建(禁用 CGO) CGO_DISABLE := CGO_ENABLED=0 -# 生产构建标志(体积优化) +# 生产构建标志 LDFLAGS := -ldflags "-s -w \ -X 'rua.plus/lolly/internal/app.Version=$(VERSION)' \ -X 'rua.plus/lolly/internal/app.GitCommit=$(GIT_COMMIT)' \ @@ -36,23 +36,8 @@ MAIN_PATH := main.go # 构建命令 # ============================================ -# 本地构建(静态链接) -build: - @echo "Building $(APP_NAME) (static)..." - @mkdir -p $(BUILD_DIR) - $(CGO_DISABLE) go build $(LDFLAGS) -o $(BUILD_DIR)/$(APP_NAME) $(MAIN_PATH) - @echo "Built: $(BUILD_DIR)/$(APP_NAME)" - @echo "Version: $(VERSION) | Commit: $(GIT_COMMIT) | Platform: $(BUILD_PLATFORM)" - -# 生产构建(体积优化,静态链接) -# build-size: -# @echo "Building $(APP_NAME) for production (static)..." -# @mkdir -p $(BUILD_DIR) -# $(CGO_DISABLE) go build $(LDFLAGS) -trimpath -o $(BUILD_DIR)/$(APP_NAME) $(MAIN_PATH) -# @echo "Production build complete: $(BUILD_DIR)/$(APP_NAME)" - # 生产构建(最大运行时性能,静态链接) -build-prod: +build: @echo "Building $(APP_NAME) with max runtime performance (static)..." @mkdir -p $(BUILD_DIR) $(CGO_DISABLE) go build $(LDFLAGS) $(PERF_GCFLAGS) $(PERF_ASMFLAGS) -trimpath \