lint: fix errcheck for fmt.Fprintf/Fprint across multiple files

Add lint.Fprint helper for unchecked fmt.Fprint calls.
Use lint.Fprintf/Fprint in api/event.go, api/image.go, rmo/root.go.
Add explicit error check for fmt.Fprintf in middleware/terminal.go cW.
This commit is contained in:
Eli Ribble 2026-05-09 02:21:53 +00:00
parent 934fb03ca2
commit c7a7e8431c
No known key found for this signature in database
5 changed files with 20 additions and 8 deletions

View file

@ -6,6 +6,7 @@ import (
"net/http"
"time"
"github.com/Gleipnir-Technology/nidus-sync/lint"
"github.com/Gleipnir-Technology/nidus-sync/platform"
"github.com/Gleipnir-Technology/nidus-sync/platform/event"
"github.com/Gleipnir-Technology/nidus-sync/version"
@ -135,7 +136,7 @@ func streamEvents(w http.ResponseWriter, r *http.Request, u platform.User) {
return
}
fmt.Fprintf(w, "data: %s\n\n", body)
lint.Fprintf(w, "data: %s\n\n", body)
w.(http.Flusher).Flush()
// Keep the connection open with a ticker sending periodic events

View file

@ -2,11 +2,11 @@ package api
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/Gleipnir-Technology/nidus-sync/lint"
"github.com/Gleipnir-Technology/nidus-sync/platform"
"github.com/Gleipnir-Technology/nidus-sync/platform/file"
"github.com/aarondl/opt/omit"
@ -80,5 +80,5 @@ func apiImageContentPost(w http.ResponseWriter, r *http.Request, u platform.User
}
w.WriteHeader(http.StatusOK)
log.Printf("Saved image file %s\n", imageUUID)
fmt.Fprintf(w, "PNG uploaded successfully")
lint.Fprintf(w, "PNG uploaded successfully")
}