💡 TIL: Today I learned that there is nothing special about pkg/
inside of Go projects. It is just like any other sub-package structure you might otherwise define in your project. It just adds an extra part to your imports. I think it’s actually confusing at best and just unnecessary typing and an unnecessary sub-structure. Just keep your packages in the top-level and be done with it 👌
@prologic@twtxt.net I think many projects largely started using it because of “the standard go project layout” which is not actually endorsed by the go core dev team. I generally advise against it for similar reasons.
@prologic@twtxt.net Sometimes it feels like a cultural import from the Java world. I work a lot with Kubernetes code and it feels a bit like a bunch of Java devs wrote it. Good Java devs, but Java devs nonetheless.
@brasshopper@twtxt.net I HATE Standard Go Project Layout, I have always prefered to structure my program by bounded context.
@brasshopper@twtxt.net That’s the thing I really hate the most about programming languages and the communities that that eventually evolve around them. You end up with (as you rightfully point out) with folks from other languages come in and start touting ways to do things that may have made a lot of sense in one language but not necessary another. Standards are great and all, but they also take away the creativity that we all enjoy in this field in the first place. Conventions are better IMO.
@prologic@twtxt.net. The issue is that (I don’t know why) programmers (often backends) are full of protocol, and they forget the basis of clean code, to pursue their protocol.
@prologic@twtxt.net I sometimes wonder if this is a breadth of experience problem. I know I did this a lot when I was first starting out. As I’ve learned more programming languages, I have noticed that I’ve gotten better at following each language’s idioms.
@brasshopper@twtxt.net Bingo! That’s just it 👌 Idioms.
That’s why you keep hearing about:
Idiomatic Go
Some years ago when I still actively developed in Python i twas:
Zen of Python
Every language has its strengths and weaknesses, like you , I really hate it when the Java or C++ crowd come bring their sillyridiculouss structures to nice languages like Go 😅 (I felt the same way about Python 2.x -> 3.x too, I just couldn’t write Python anymore 😅)
@lyse@lyse.isobeef.org You are right of course ! 👌 but what we’re talking about here I think it’s probably very experienced program is from one language coming to another language so there isn’t much learning the new patterns of such? Anyway 🤷♂️
@lyse@lyse.isobeef.org Yeah I agree, and that does happen.