lint: fix errcheck for Close and Write calls across multiple files

Use lint.LogOnErr for deferred Body/File/Client Close calls.
Use lint.Write for unchecked w.Write calls.
Fix bug in sync/sms.go where fmt.Errorf result was discarded
(replace with proper log.Error call).
This commit is contained in:
Eli Ribble 2026-05-09 02:29:07 +00:00
parent c7a7e8431c
commit 0ec810591e
No known key found for this signature in database
9 changed files with 24 additions and 15 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/Gleipnir-Technology/arcgis-go"
"github.com/Gleipnir-Technology/nidus-sync/config"
"github.com/Gleipnir-Technology/nidus-sync/lint"
"github.com/Gleipnir-Technology/nidus-sync/db"
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/model"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
@ -48,7 +49,7 @@ func DoTokenRequest(ctx context.Context, form url.Values) (*OAuthTokenResponse,
if err != nil {
return nil, fmt.Errorf("Failed to do request: %w", err)
}
defer resp.Body.Close()
defer lint.LogOnErr(resp.Body.Close, "close response body")
bodyBytes, err := io.ReadAll(resp.Body)
log.Info().Int("status", resp.StatusCode).Msg("Token request")
if resp.StatusCode >= http.StatusBadRequest {