mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix(scripts): handle ignored enc.Encode error in telemetry server (#22855)
Check the `json.Encoder.Encode` error and print to stderr. Part of the effort to enable `errcheck.check-blank` in golangci-lint.
This commit is contained in:
committed by
GitHub
parent
e6983648aa
commit
9e7125f852
@@ -43,7 +43,9 @@ func main() {
|
||||
"version": r.Header.Get("X-Telemetry-Version"),
|
||||
"data": json.RawMessage(body),
|
||||
}
|
||||
_ = enc.Encode(output)
|
||||
if err := enc.Encode(output); err != nil {
|
||||
_, _ = fmt.Fprintf(os.Stderr, "Error encoding telemetry output: %v\n", err)
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user