fix: 修复 sora_sdk_client 类型断言未检查的 errcheck lint 错误
使用安全的 comma-ok 模式替代裸类型断言,避免 golangci-lint errcheck 报错。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user