fix(feishu): resolve lint errors for shadow and formatting

- Rename err variables to avoid shadowing in downloadExternalImage
- Fix struct field alignment in TestExtractCardImageKeys

Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
This commit is contained in:
ywj 2026-03-15 12:27:10 +08:00
parent efd67355e8
commit c58c3fe044
2 changed files with 61 additions and 61 deletions

View file

@ -753,25 +753,25 @@ func (c *FeishuChannel) downloadExternalImage(
return "" return ""
} }
if _, err := io.Copy(out, resp.Body); err != nil { if _, copyErr := io.Copy(out, resp.Body); copyErr != nil {
out.Close() out.Close()
os.Remove(localPath) os.Remove(localPath)
logger.ErrorCF("feishu", "Failed to write external image to file", map[string]any{ logger.ErrorCF("feishu", "Failed to write external image to file", map[string]any{
"error": err.Error(), "error": copyErr.Error(),
}) })
return "" return ""
} }
out.Close() out.Close()
// Store in MediaStore // Store in MediaStore
ref, err := store.Store(localPath, media.MediaMeta{ ref, storeErr := store.Store(localPath, media.MediaMeta{
Filename: filename, Filename: filename,
Source: "feishu_external", Source: "feishu_external",
}, scope) }, scope)
if err != nil { if storeErr != nil {
logger.ErrorCF("feishu", "Failed to store external image", map[string]any{ logger.ErrorCF("feishu", "Failed to store external image", map[string]any{
"url": imageURL, "url": imageURL,
"error": err.Error(), "error": storeErr.Error(),
}) })
os.Remove(localPath) os.Remove(localPath)
return "" return ""