The bigger lesson is that this is yet another example of premature optimization biting you. Developers love to prove how smart they are through clever code - few realize the ultimate cost of this. I could laugh about it if it wasn’t so common.
> On Jun 1, 2025, at 10:21 AM, Oliver Eikemeier <eikeme...@fillmore-labs.com> > wrote: > > >> >> Am 27.06.2024 um 05:17 schrieb Ian Lance Taylor <i...@golang.org>: >> >>> On Tue, Jun 25, 2024 at 9:37 PM 'Axel Wagner' via golang-nuts >>> <golang-nuts@googlegroups.com> wrote: >>> >>> you might be interested to learn that Ian has filed a CL adding an FAQ >>> entry. >> >> Now committed at https://go.dev/doc/faq#zero_size_types . >> >> Ian > > Thanks for that. I discovered that comparing pointers to ZSTs is pretty > popular in Go: > > - x/sync/singleflight: > https://cs.opensource.google/go/x/sync/+/refs/tags/v0.14.0:singleflight/singleflight_test.go;l=78 > > - Delve: > https://github.com/go-delve/delve/blob/v1.24.2/service/debugger/debugger.go#L387 > > - Grafana: > https://github.com/grafana/grafana/blob/v12.0.1/pkg/services/serviceaccounts/extsvcaccounts/service.go#L353 > > - Skaffold: > https://github.com/GoogleContainerTools/skaffold/blob/v2.16.0/pkg/skaffold/hooks/render.go#L93 > > - Coder: https://github.com/coder/coder/blob/v2.22.1/cli/ssh.go#L578 > > - quic-go: > https://github.com/quic-go/quic-go/blob/v0.52.0/connection_test.go#L1008 > > - SigStore Cosign: > https://github.com/sigstore/cosign/blob/v2.5.0/cmd/cosign/cli/attest/attest_blob_test.go#L60 > > Seems like a classic example of Hyrum's Law, we now have a lot of code that > depends on runtime.zerobase. > > > I’ve written a linter along with an accompanying blog post about the subject: > > fillmore-labs.com/zerolint: https://github.com/fillmore-labs/zerolint > > “The Perils of Pointers in the Land of the Zero-Sized Type”: > https://blog.fillmore-labs.com/posts/zerosized-1/ > > > I would be interested whether I got the “default” level right. Or maybe > everything wrong. > > Thanks for the insight, again > Oliver > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/golang-nuts/E3CEC319-7CE2-4ECF-B3A5-427F32269B0D%40fillmore-labs.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/DFD080DC-27CD-4E1C-880E-73DA2B22AF6D%40ix.netcom.com.