mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
fix: handle errcheck for Rows.Close and resp.Body.Close in sora code
This commit is contained in:
@@ -90,7 +90,7 @@ func (r *SoraTaskRepository) ListPending(ctx context.Context) ([]*service.SoraTa
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
defer func() { _ = rows.Close() }()
|
||||
|
||||
var tasks []*service.SoraTask
|
||||
for rows.Next() {
|
||||
|
||||
@@ -379,7 +379,7 @@ func (s *SoraTaskService) forwardGetToUpstream(
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("upstream request: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
respBody, err := io.ReadAll(io.LimitReader(resp.Body, 256*1024))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user