chore(config): 调整 golangci-lint 和 Makefile 配置

golangci.yml:
- 排除 lua 包的 revive stuttering 检查
- 配置 revive exported 规则禁用 stuttering 检查

Makefile:
- 简化构建命令,移除冗余的 build 和 build-prod 区分
- 默认 build 使用最大性能优化构建

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-04-10 16:55:47 +08:00
parent 7156bbc82f
commit 52a210ed19
2 changed files with 14 additions and 18 deletions

View File

@ -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
disabled: false
- name: exported
severity: warning
disabled: false
arguments:
- "disableStutteringCheck"

View File

@ -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 \