fix(backend): handle defer Close() errors in crs_sync_service
修复 golangci-lint 错误检查问题 - 使用匿名函数包装 defer Close() 并忽略错误 - 符合 Go 最佳实践
This commit is contained in:
@@ -783,7 +783,7 @@ func crsLogin(ctx context.Context, client *http.Client, baseURL, username, passw
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
raw, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
@@ -818,7 +818,7 @@ func crsExportAccounts(ctx context.Context, client *http.Client, baseURL, adminT
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
raw, _ := io.ReadAll(io.LimitReader(resp.Body, 5<<20))
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
|
||||
Reference in New Issue
Block a user