3 ms·
Go made a great decision to namespace packages via this Github style.
by rochak 3y ago
Go made a great decision to namespace packages via this Github style.
- treyd 3y agoAnd the horrible decision to not make library-level ("module") and code-unit-level ("package") namespacing orthogonal. The former was an afterthought tacked on since the package system was designed to be used only within Google's monorepo and little care was paid to how it would work when it was released to the public and used more generally.
- starttoaster 3y agoI want to understand what you just said, but I fear watering your language down a bit might be a tall ask with some people. Would you be willing to eli5 what you believe Go did that was a horrible decision with regards to module/package namespacing?
- cdelsolar 3y agoI think he wants them to be treated differently for some reason.
- ezrast 3y agoI think what they mean is: if you see a line like `import git.example.com/foo/bar/baz`, that could be package `baz` inside module `git.example.com/foo/bar`, or it could be package `bar/baz` inside module `git.example.com/foo`. Also, even if you know it's the latter, package namespacing isn't strictly related to directory structure, so `bar/baz` has no specific meaning outside of the context of a go import. They could have used any other separator for package components - `git.example.com/foo:bar:baz` - but instead they chose the slash, making the scheme both technically ambiguous and easy to confuse for an HTTP URL.
- starttoaster 3y agoAh that makes sense. I think Go did somewhat stumble a bit in the early days due to this, especially with repositories in GitLab, where GitLab allows essentially a directory tree where your repository can be nested indefinitely in directories like `https://gitlab.com/mygroup/subgroup1/subgroup2/repository https://gitlab.com/mygroup/subgroup1/subgroup2/repository`. I still don't think this is a huge issue, to be honest. Not one big enough for me to complain about, for sure. But it's definitely not ideal.
- baby 3y agoHow is this a good decision? You have to alias packages when names collide
- tapirl 3y agoWhat is the better decision to avoid name colliding?
- pjmlp 3y agoGo packages is yet another design item that I dislike on the language, exposing SCM URLs directly on the source code, and no story for binary caching.
- yencabulator 3y ago> exposing SCM URLs directly on the source code Incorrect. You're able to use any URL you control, regardless of where your SCM is located.
- pjmlp 3y agoThanks for pointing out you didn't got what the whole point of the wrong design is about.
- yencabulator 3y agoThanks for confirming you'd rather be a hater than someone with justified opinions.
- pjmlp 3y agoI am quite open about my opinion regarding most of Go's design decisions.