Commit 372a0129 authored by ianshaw's avatar ianshaw
Browse files

fix(backend): handle defer Close() errors in crs_sync_service

修复 golangci-lint 错误检查问题
- 使用匿名函数包装 defer Close() 并忽略错误
- 符合 Go 最佳实践
parent 8b163ca4
...@@ -783,7 +783,7 @@ func crsLogin(ctx context.Context, client *http.Client, baseURL, username, passw ...@@ -783,7 +783,7 @@ func crsLogin(ctx context.Context, client *http.Client, baseURL, username, passw
if err != nil { if err != nil {
return "", err return "", err
} }
defer resp.Body.Close() defer func() { _ = resp.Body.Close() }()
raw, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) raw, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
if resp.StatusCode < 200 || resp.StatusCode >= 300 { if resp.StatusCode < 200 || resp.StatusCode >= 300 {
...@@ -818,7 +818,7 @@ func crsExportAccounts(ctx context.Context, client *http.Client, baseURL, adminT ...@@ -818,7 +818,7 @@ func crsExportAccounts(ctx context.Context, client *http.Client, baseURL, adminT
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer resp.Body.Close() defer func() { _ = resp.Body.Close() }()
raw, _ := io.ReadAll(io.LimitReader(resp.Body, 5<<20)) raw, _ := io.ReadAll(io.LimitReader(resp.Body, 5<<20))
if resp.StatusCode < 200 || resp.StatusCode >= 300 { if resp.StatusCode < 200 || resp.StatusCode >= 300 {
......
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