Fix a bunch of not-checking-error lints

This commit is contained in:
Eli Ribble 2026-05-04 20:29:02 +00:00
parent 114aec73ed
commit 5f3fcc2b3e
No known key found for this signature in database
14 changed files with 124 additions and 34 deletions

View file

@ -4,6 +4,8 @@ import (
"encoding/json"
"fmt"
"time"
"github.com/Gleipnir-Technology/nidus-sync/lint"
)
// DraftRequest represents the request body for creating a draft
@ -94,7 +96,7 @@ func (c *Client) CreateDraft(taskID int, draft *DraftRequest) (*Draft, error) {
if err != nil {
return nil, fmt.Errorf("failed to POST %s: %w", path, err)
}
defer resp.Body.Close()
defer lint.LogOnErr(resp.Body.Close, "close response body")
// Parse response
var createdDraft Draft

View file

@ -3,6 +3,8 @@ package labelstudio
import (
"encoding/json"
"fmt"
"github.com/Gleipnir-Technology/nidus-sync/lint"
)
type TaskResultValue struct {
@ -171,7 +173,7 @@ func (c *Client) TaskUpdate(taskID int, update *TaskUpdate) (*Task, error) {
if err != nil {
return nil, fmt.Errorf("failed to PATCH %s: %w", path, err)
}
defer resp.Body.Close()
defer lint.LogOnErr(resp.Body.Close, "close response")
// Parse response
var updatedTask Task

View file

@ -4,6 +4,8 @@ import (
"encoding/json"
"fmt"
"time"
"github.com/Gleipnir-Technology/nidus-sync/lint"
)
// User represents a user in Label Studio
@ -33,7 +35,7 @@ func (c *Client) ListUsers() ([]User, error) {
if err != nil {
return nil, fmt.Errorf("failed to GET /api/userls: %w", err)
}
defer resp.Body.Close()
defer lint.LogOnErr(resp.Body.Close, "close response")
// Parse response
var users []User