News for hackers. Stuff that matters.
Re:Excessive nil pointer checks in Go by ignoramous on Sunday June 21, 2026 @02:56PM (#48621559)
> Don't use pointers at all, always allocate structs on the stack

Unless one makes the rookie mistake of passing these structs to pkg log (which box to any/interface{}) instead of slog [0]... then they escape to heap. If a project relies on avoiding heap allocs, prudent to 'go build -gcflags="-m"' on every check-in, and review the diff from that too.

[0] https://go.dev/blog/slog

Re:Excessive nil pointer checks in Go by Fire-Dragon-DoL on Sunday June 21, 2026 @03:49PM (#48621998)
Good to know, but wouldn't that be something that pops up when profiling?
Re:Excessive nil pointer checks in Go by ignoramous on Tuesday June 23, 2026 @08:44PM (#48653680)
Runtime profiling / tracing (runtime.MemProfile & debug.FlightRecoder)? Yes... At test time (go bench -benchmem), also yes.