The Wire · Showcase
GO RUNTIME FIXES A SUBTLE BODY-CLOSE BUG
By RepoJournal · Filed · About Go
The net/http change you didn't know you needed just landed, and it could save you from chasing a phantom io.EOF.
The first story of the day is a quiet but critical fix in net/http: closing a server request body now correctly returns nil instead of io.EOF when the handler stops reading early and the body is drained [1]. This regression came from CL 794640, which consolidated request body draining and dropped the assignment that cleared the error. For any handler that relies on Close returning nil after a successful drain, this is the fix you've been waiting for. Meanwhile, the compiler team is at it again on loong64: a new optimization folds ANDconst with 16/32-bit all-ones masks into zero-extension instructions, removing 644 instructions from the Go binary [2]. That's a meaningful win for anyone targeting loong64. The third story is a Plan 9 landmine: using LEAVE on amd64 for Plan 9 stubs can cause a crash because BP holds the system call number, not the frame pointer [3]. This is a 'pat your back if you're on Plan 9' moment, but it's a good reminder that platform-specific code has sharp edges. If you're on Plan 9, this change is a must-have before your next build. For the rest of us, the net/http fix deserves a quick patch and a regression test.
One email a day. Unsubscribe in one click.
Keep up with Go in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Review net/http request body close handling and update if you rely on Close returning nil after drain golang/go [immediate]
- → If targeting loong64, rebuild your binary to pick up the instruction fold optimization golang/go [plan]
- → For Plan 9/amd64 builds, verify your toolchain includes the LEAVE avoidance fix before deploying golang/go [immediate]
References
- [1] net/http: clear io.EOF when Close drains a server request body golang/go
- [2] cmd/compile: fold ANDconst with 16/32-bit all-ones mask to zero-extend on loong64 golang/go
- [3] cmd/internal/obj/x86: don't use LEAVE on plan9/amd64 golang/go