From 2f06c696facfbc34c20fcdb5ab82e5db16175f90 Mon Sep 17 00:00:00 2001 From: mapleafgo Date: Thu, 9 Apr 2026 16:52:48 +0800 Subject: [PATCH] refactor: replace interface{} with any for modern Go style Update callback function signatures to use the any alias introduced in Go 1.18, improving code readability and following current Go conventions. Co-authored-by: Qwen-Coder --- pkg/tts/aliyun.go | 4 ++-- pkg/video/play.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/tts/aliyun.go b/pkg/tts/aliyun.go index 9f050ce..fc1a46d 100644 --- a/pkg/tts/aliyun.go +++ b/pkg/tts/aliyun.go @@ -34,13 +34,13 @@ type result struct { var DefaultTTS = &AliTTS{} // onTaskFailed TTS 合成失败回调 -func (tts *AliTTS) onTaskFailed(text string, param interface{}) { +func (tts *AliTTS) onTaskFailed(text string, param any) { p, _ := param.(*result) p.Error = fmt.Errorf("语音合成异常: %v", text) } // onSynthesisResult TTS 合成数据回调 -func (tts *AliTTS) onSynthesisResult(data []byte, param interface{}) { +func (tts *AliTTS) onSynthesisResult(data []byte, param any) { p, _ := param.(*result) p.Data.Write(data) } diff --git a/pkg/video/play.go b/pkg/video/play.go index a69cd80..3c88dd6 100644 --- a/pkg/video/play.go +++ b/pkg/video/play.go @@ -30,7 +30,7 @@ func Play(ctx context.Context, path string, local bool) error { done := make(chan struct{}) defer close(done) - _, err = eventManager.Attach(libvlc.MediaPlayerEndReached, func(libvlc.Event, interface{}) { + _, err = eventManager.Attach(libvlc.MediaPlayerEndReached, func(libvlc.Event, any) { done <- struct{}{} }, nil) if err != nil {