1 Commits
v1.0.2 ... main

Author SHA1 Message Date
2f06c696fa 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 <qwen-coder@alibabacloud.com>
2026-04-09 16:52:48 +08:00
2 changed files with 3 additions and 3 deletions

View File

@@ -34,13 +34,13 @@ type result struct {
var DefaultTTS = &AliTTS{} var DefaultTTS = &AliTTS{}
// onTaskFailed TTS 合成失败回调 // onTaskFailed TTS 合成失败回调
func (tts *AliTTS) onTaskFailed(text string, param interface{}) { func (tts *AliTTS) onTaskFailed(text string, param any) {
p, _ := param.(*result) p, _ := param.(*result)
p.Error = fmt.Errorf("语音合成异常: %v", text) p.Error = fmt.Errorf("语音合成异常: %v", text)
} }
// onSynthesisResult TTS 合成数据回调 // onSynthesisResult TTS 合成数据回调
func (tts *AliTTS) onSynthesisResult(data []byte, param interface{}) { func (tts *AliTTS) onSynthesisResult(data []byte, param any) {
p, _ := param.(*result) p, _ := param.(*result)
p.Data.Write(data) p.Data.Write(data)
} }

View File

@@ -30,7 +30,7 @@ func Play(ctx context.Context, path string, local bool) error {
done := make(chan struct{}) done := make(chan struct{})
defer close(done) defer close(done)
_, err = eventManager.Attach(libvlc.MediaPlayerEndReached, func(libvlc.Event, interface{}) { _, err = eventManager.Attach(libvlc.MediaPlayerEndReached, func(libvlc.Event, any) {
done <- struct{}{} done <- struct{}{}
}, nil) }, nil)
if err != nil { if err != nil {