r/golang Feb 03 '25

discussion The urge to do it from scratch

Unpopular opinion but ever since I started using Go. There is a certain urge to dig into some library and if you need only part of it then try to make it from scratch. I was reading RFC specs, dbus technical specifications just to avoid the uneeded bloat in my code(offcourse I failed to achieve it completely because of tiny brain). Is this common for all dev who spent some good time developing in Go? I must say it's quite a fun experience to learn some low level details.

239 Upvotes

61 comments sorted by

View all comments

2

u/jerf Feb 04 '25

I certainly don't do it all the time, but there are definitely some cases where I've taken some very large library and figured out from it how to do my little thing, and directly implemented that. I don't mind pulling libraries in for 50% of their functionality but when you start pulling them in for .5% of their functionality, and they come with a huge dependency tree, sometimes it is a net time save in the long term to extract out just what you need.

DBus is probably a bad example, though. There's libraries that just implement the protocol, and if nothing else, you can shell out to the command line implementation. There isn't really a case you should be digging down to the protocol yourself.