Better HN
topnewbestaskshowjobs
Log inSign up

chemcube

1 karma · joined Feb 4, 2024 (2y ago) · 3 submissions

Submissions

comment 2y ago · link · parent

Hi. Author here. Didn't mean to irritate you. I'm quite familiar with the standard library. And I'm familiar with rants by the Go team about all the early code and patterns they wish they could wave away with a magic wand :) And that the std lib does some things that no user of Go typically needs to do. I could write another post about how net/http goes against most of what this post advises, and for a good reason. But I didn't talk about that because my point would be more easily lost and no one reading my post is writing a their own http/grpc server. I agree that someone shouldn't just say "best practices" and move on without an explanation. I didn't delve into this in the post because that wasn't the topic, and I overestimated how common this knowledge is (it's well documented inside of Google, and at the time of writing, I thought it was also published externally).

This "best practice" seems to be what most of the comments on this thread discuss, so I'll likely go in-depth with a post on this next week. Cheers.

comment 2y ago · link · parent

Hey. Author here. Yeah, the Go style guide at Google (the setting for the dcode review) is quite prescriptive. I don't mind labeling things "anti-patterns". It doesn't mean there's a law against using said pattern (if you're in a healthy org). It just means you should be able to justify why you go against the guideline. The whole reason I was comfortable attempting that approach in the first place is because I had successfully used that pattern before and was able to provide a rationale. It just happens that this case differed enough that using this pattern would've been unwise.

You're right that things shouldn't just be classed as an anti-pattern without explaining why. And that's enforced in most Go-heavy orgs at Google. If you're gonna say something is bad without providing an explanation and linking to the relevant sources, the comment is likely to be closed or argued.

I didn't provide an explanation for why this is considered an anti-pattern in this post because that wasn't the topic. But it appears most persons here are interested in that, so maybe I'll write a post on that next week :)