Commit 935ea666 authored by huangenjun's avatar huangenjun
Browse files

fix: 修复 sora_sdk_client 类型断言未检查的 errcheck lint 错误



使用安全的 comma-ok 模式替代裸类型断言,避免 golangci-lint errcheck 报错。
Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 26060e70
......@@ -541,14 +541,19 @@ func (c *SoraSDKClient) GetVideoTask(ctx context.Context, account *Account, task
func (c *SoraSDKClient) getSDKClient(account *Account) (*sora.Client, error) {
proxyURL := c.resolveProxyURL(account)
if v, ok := c.sdkClients.Load(proxyURL); ok {
return v.(*sora.Client), nil
if cli, ok2 := v.(*sora.Client); ok2 {
return cli, nil
}
}
client, err := sora.New(proxyURL)
if err != nil {
return nil, fmt.Errorf("创建 Sora SDK 客户端失败: %w", err)
}
actual, _ := c.sdkClients.LoadOrStore(proxyURL, client)
return actual.(*sora.Client), nil
if cli, ok := actual.(*sora.Client); ok {
return cli, nil
}
return client, nil
}
func (c *SoraSDKClient) resolveProxyURL(account *Account) string {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment