fix: handle conn.Write and fmt.Fprintf errors in echo/webserver examples (PILOT-299)#6
fix: handle conn.Write and fmt.Fprintf errors in echo/webserver examples (PILOT-299)#6matthew-pilot wants to merge 1 commit into
Conversation
…xamples (PILOT-299) Previously, conn.Write errors in go/echo/main.go and fmt.Fprintf errors in go/webserver/main.go were silently discarded. Since these are example programs that users copy, they should model correct error handling. Added log.Printf on write errors with a return (echo) or no-op continue (webserver HTTP handler where the framework handles teardown).
📊 PR Status — #6 PILOT-299
CI Checks (4/4 passing)
CanaryNot applicable — examples repo, no canary configured. |
🔍 PR Explanation — #6 PILOT-299What this doesFixes silent error discarding in two Go example programs that users commonly copy as starter code. The problem
The fix
Impact
CI4/4 green (go-examples ✅, python-examples ✅, shell-examples ✅, snyk ✅) |
🔍 Matthew Explains — #6 PILOT-299What this doesAdds error handling for WhyThese are example programs that users copy as templates. Silently ignoring write errors models bad practice. Real programs should at minimum log the error so operators can detect broken connections or resource exhaustion. Changes (2 files, +15/−5 LoC)
For the webserver, HTTP handler teardown is framework-managed, so the handler only logs the error rather than returning early. CanaryNot configured for examples repo. |
📊 Matthew PR Status — #6 PILOT-299
CI Checks (3/3 passing)
VerdictCLEAN — all CI green, small fix (2 files, +15/−5). Safe to merge. |
|
📊 Status — PILOT-299
🤖 auto-status by matthew-pilot |
|
🔍 PR Clarification — PILOT-299 @TeoSlayer — this PR is ready for review:
No operator comments or reviews since opening. Let me know if you have questions or if this looks good to merge. 🤖 auto-clarify by matthew-pilot |
🤖 PR Clarification — Review Requested#6: fix: handle conn.Write and fmt.Fprintf errors in echo/webserver examples (PILOT-299) SummarySummary
What
Changes
Verification
Changes+15/−5 across 2 file(s):
CI Statuspython-examples ✅ | go-examples ✅ | shell-examples ✅ Labels(none) 👋 @TeoSlayer — this PR is ready for your review. matthew-pr-worker • 2026-06-01T12:55:00Z |
Summary
What
go/echo/main.goandgo/webserver/main.gosilently discarded write errors (conn.Write,fmt.Fprintf). Since these are example programs that users copy, they should model correct error handling.Changes
conn.Writeerror for both raw and prefixed echo pathsfmt.Fprintferrors in/and/statushandlers (HTTP handler teardown is framework-managed)Verification
go build ./...✓ (both echo and webserver)go vet ./...✓go test ./...✓Checklist