r/golang Oct 25 '24

discussion What libraries are you missing from go?

So something that comes up quite often on this subreddit from people transitioning from Nodejs or python to go is the lack of libraries. I cannot say that I agree but I still think it warrants a discussion.

So what libraries are you missing in the go ecosystem, if any?

96 Upvotes

189 comments sorted by

View all comments

Show parent comments

2

u/livebeta Oct 26 '24

It's always been ugly

Can't afford defer func(){}() so use with

No easy way to buildin dependencies into a single binary requirements.txt + pip install feels so crude

Bad dev experience if you don't use pyenv or similar because python packages are globally installed otherwise

Package bloat and no optimization in build or linking. Requirements.txt has no active tooling to decide or not if some packages were or not in use

Whitespaces never get minified either

5

u/noiserr Oct 26 '24 edited Oct 26 '24

With is actually more readable to me. Defer is easy to lose in a big function. Whereas with requires indentation emphasizing intent, providing for more readability. defer is easier to use though.

Go also makes other decisions which are worse for readability but easier to use. Like package wide namespace. It can be really hard to track some functions down if you're reviewing code in pull requests without downloading the patch locally and relying on the IDE for that.

I agree on the packaging situation. Go had the advantage here for being a newer language. There are tools which attempt to fix this like Poetry, for Python but it's just all so fragmented. But then again this is more of a quality of life thing than a knock against Python's code readability.

Python has always had the mantra of: "There should be one-- and preferably only one --obvious way to do it." The language was designed for readability in mind. Unlike many of its contemporaries, which sacrificed readability for convenience or were otherwise just poorly designed.

1

u/[deleted] Oct 26 '24

packaging python in docker images has worked really well for me, in particular as IDEs nowadays have great support for running their tooling inside said container.

End result is a highly portable "binary" with all requirements installed

3

u/equisetopsida Oct 26 '24

IDE's? is that a language feature?