From 2dbcd86145f2fc26e85ed66d2c45a796985f7be9 Mon Sep 17 00:00:00 2001 From: Md Mushfiqur Rahim <20mahin2020@gmail.com> Date: Fri, 29 May 2026 12:54:16 +0600 Subject: [PATCH] refactor: replace interface{} with any (Go 1.18+) --- internal/data/downloader.go | 2 +- internal/types/types.go | 10 +++++----- internal/ui/display.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/data/downloader.go b/internal/data/downloader.go index b5a0a39..865de9b 100644 --- a/internal/data/downloader.go +++ b/internal/data/downloader.go @@ -32,7 +32,7 @@ func NewDownloader() *Downloader { } // printTimestampedMessage 打印带时间戳的消息 -func printTimestampedMessage(format string, args ...interface{}) { +func printTimestampedMessage(format string, args ...any) { timestamp := time.Now().Format("15:04:05") message := fmt.Sprintf(format, args...) fmt.Printf("[%s] %s\n", timestamp, message) diff --git a/internal/types/types.go b/internal/types/types.go index cea2407..7542231 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -251,8 +251,8 @@ type PipelineContext struct { Domain string StartTime time.Time Result *DetectionResult - Connections interface{} // 使用interface{}来支持不同的连接管理器类型 - Cache interface{} // 使用interface{}来支持不同的缓存管理器类型 + Connections any // 使用interface{}来支持不同的连接管理器类型 + Cache any // 使用interface{}来支持不同的缓存管理器类型 Config *Config EarlyExit bool Error error @@ -275,14 +275,14 @@ type CacheManager struct { // HTTPClient HTTP客户端 type HTTPClient struct { - Client interface{} // *http.Client - Transport interface{} // *http.Transport + Client any // *http.Client + Transport any // *http.Transport } // TLSClient TLS客户端 type TLSClient struct { Config *TLSConfig - Conn interface{} // *tls.Conn + Conn any // *tls.Conn } // DNSResolver DNS解析器 diff --git a/internal/ui/display.go b/internal/ui/display.go index cbf1ade..1641f20 100644 --- a/internal/ui/display.go +++ b/internal/ui/display.go @@ -31,7 +31,7 @@ func PrintUsage() { } // PrintTimestampedMessage 打印带时间戳的消息 -func PrintTimestampedMessage(format string, args ...interface{}) { +func PrintTimestampedMessage(format string, args ...any) { timestamp := time.Now().Format("15:04:05") message := fmt.Sprintf(format, args...) fmt.Printf("[%s] %s\n", timestamp, message)