diff --git a/internal/cache/disk_cache.go b/internal/cache/disk_cache.go index c895a6f..14e2636 100644 --- a/internal/cache/disk_cache.go +++ b/internal/cache/disk_cache.go @@ -370,7 +370,7 @@ func (dc *DiskCache) Set(hashKey uint64, origKey string, data []byte, headers ma return } if err := os.Rename(tmpDataPath, dataPath); err != nil { - os.Remove(tmpDataPath) + _ = os.Remove(tmpDataPath) return } @@ -384,7 +384,7 @@ func (dc *DiskCache) Set(hashKey uint64, origKey string, data []byte, headers ma return } if err := os.Rename(tmpMetaPath, metaPath); err != nil { - os.Remove(tmpMetaPath) + _ = os.Remove(tmpMetaPath) return } @@ -424,8 +424,8 @@ func (dc *DiskCache) Delete(hashKey uint64) error { // 删除文件 dataPath := dc.filePathFromHash(hashKey, "data") metaPath := dc.filePathFromHash(hashKey, "meta") - os.Remove(dataPath) - os.Remove(metaPath) + _ = os.Remove(dataPath) + _ = os.Remove(metaPath) return nil } @@ -505,7 +505,7 @@ func (dc *DiskCache) evict() { // 删除文件 dataPath := dc.filePathFromHash(oldestKey, "data") metaPath := dc.filePathFromHash(oldestKey, "meta") - os.Remove(dataPath) - os.Remove(metaPath) + _ = os.Remove(dataPath) + _ = os.Remove(metaPath) } } diff --git a/internal/lua/api_socket_tcp.go b/internal/lua/api_socket_tcp.go index b1b1400..d849bfa 100644 --- a/internal/lua/api_socket_tcp.go +++ b/internal/lua/api_socket_tcp.go @@ -429,7 +429,7 @@ func (s *TCPSocket) Close() error { // 关闭连接 if s.conn != nil { - s.conn.Close() + _ = s.conn.Close() s.conn = nil } @@ -802,7 +802,7 @@ func tcpSocketSetTimeouts(L *glua.LState) int { // tcpSocketGC __gc 元方法 func tcpSocketGC(L *glua.LState) int { socket := checkTCPSocket(L, 1) - socket.Close() + _ = socket.Close() return 0 } diff --git a/internal/middleware/security/geoip.go b/internal/middleware/security/geoip.go index d7a09e6..d27bd9d 100644 --- a/internal/middleware/security/geoip.go +++ b/internal/middleware/security/geoip.go @@ -82,7 +82,7 @@ func NewGeoIPLookup(dbPath string, cacheSize int, ttl time.Duration, privateIPBe cache, err := lru.New[string, *cachedCountry](cacheSize) if err != nil { - db.Close() + _ = db.Close() return nil, fmt.Errorf("create lru cache: %w", err) } diff --git a/internal/server/server.go b/internal/server/server.go index ef1b5ab..da96fb8 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -534,7 +534,7 @@ func (s *Server) createListener(cfg *config.ServerConfig) (net.Listener, error) // 2. 清理旧 socket 文件 if _, err := os.Stat(socketPath); err == nil { - os.Remove(socketPath) + _ = os.Remove(socketPath) } // 3. 创建 Unix socket listener