From 78c49f7288da0ad35495ed1e96d5fa11314b5518 Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 13 Apr 2026 11:44:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(lint):=20=E4=BF=AE=E5=A4=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=B8=85=E7=90=86=E5=92=8Clint=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 proxy.go 未使用的 protoHTTPS 常量 - 修复 api_shared_dict.go 无效赋值警告 - 修复 certpool.go unused-parameter 警告 Co-Authored-By: Claude Opus 4.6 --- internal/lua/api_shared_dict.go | 3 +-- internal/proxy/proxy.go | 4 ---- internal/sslutil/certpool.go | 3 +-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/internal/lua/api_shared_dict.go b/internal/lua/api_shared_dict.go index 0ff9e33..43cde5d 100644 --- a/internal/lua/api_shared_dict.go +++ b/internal/lua/api_shared_dict.go @@ -347,8 +347,7 @@ func dictFlushExpired(L *glua.LState) int { // dictGetKeys 获取所有键 // dict:get_keys(max_count?) -> keys func dictGetKeys(L *glua.LState) int { - //nolint:ineffassign,unused - _ = checkSharedDict(L) + checkSharedDict(L) // 验证参数但不使用返回值 // 暂不实现完整版,返回空表 keys := L.NewTable() diff --git a/internal/proxy/proxy.go b/internal/proxy/proxy.go index da7a131..ea5243f 100644 --- a/internal/proxy/proxy.go +++ b/internal/proxy/proxy.go @@ -56,10 +56,6 @@ const ( // upstreamCache 上游缓存标识 // 用于标记请求可直接使用缓存响应,无需转发到上游 upstreamCache = "CACHE" - - // protoHTTPS 使用 HTTPS 协议 - // 标记与上游目标通信时使用 HTTPS 加密传输 - protoHTTPS = "https" ) // Proxy 表示反向代理实例,负责将 HTTP 请求转发到后端目标。 diff --git a/internal/sslutil/certpool.go b/internal/sslutil/certpool.go index 6b09d0c..ce309f3 100644 --- a/internal/sslutil/certpool.go +++ b/internal/sslutil/certpool.go @@ -13,12 +13,11 @@ import ( // // Parameters: // - certFile: Certificate file path -// - context: Context description for error messages // // Returns: // - *x509.CertPool: Certificate pool // - error: Returns error if loading fails -func LoadCertPool(certFile string, context string) (*x509.CertPool, error) { +func LoadCertPool(certFile string, _ string) (*x509.CertPool, error) { data, err := os.ReadFile(certFile) if err != nil { return nil, fmt.Errorf("failed to read certificate file: %w", err)