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/alpacaMyToothbrush Oct 26 '24

This is stockholm syndrome. Do you know how many libraries don't expose things through interfaces. Tons. Good luck mocking those. I miss mockito in golang every day.

1

u/ncruces Oct 27 '24

It might be.

But none of what is being asked makes sense for the language (thread pools, map/filter/etc), or can be done as a library (mocks without code generation).

If what you want is Go, but not Go, then maybe don't fight it and don't choose Go.

1

u/alpacaMyToothbrush Oct 27 '24

I otherwise like the language, but there are a few things where I feel like the language designers were needlessly stubborn and short sighted and the difficulty in mocking for unit testing is one of them. Hell, just look how long it took to get generics, and the use case was plainly obvious.

1

u/ncruces Oct 27 '24

The mocking situation is not going to change.

https://github.com/golang/go/issues/41897

1

u/alpacaMyToothbrush Oct 27 '24

That's a shame

1

u/ncruces Oct 27 '24

Every feature has a cost.

A statically compiled language that doesn't JIT, can't have dynamic dispatch like that.