logoalt Hacker News

the__alchemisttoday at 1:43 AM5 repliesview on HN

Interesting! Are Go backend building custom auth, admin, DB ORM/migrations/auto migrations, templates, email, dev server etc for each project? Or each person and org has their own toolkit they use?


Replies

marcus_holmestoday at 2:01 AM

We tend not to use ORMs, because they're evil.

There are various libraries people use for auth, etc. But rolling your own isn't hard - Go has (e.g.) bcrypt in the standard library, so most of the heavy lifting is already done, you can write a solid auth implementation in <50 lines of code using that.

Generally Go prefers libraries to frameworks. Wrap the hard bits up into a library that can then be used widely in any implementation, rather than rolling it into a one-size-fits-all implementation that doesn't really suit anyone properly.

show 1 reply
Quothlingtoday at 4:48 PM

Yes.

I think few people would want to use an ORM for the stuff you use Go for, but there are things like SQLC which can generate a lot of your "dynamic DB magic" without actually being a real dependency. You can set SQLC up to run in a container in a completely isolated environment, and then use the output, but you can frankly also just maintain the SQL which frankly isn't that different than using an ORM once you've set up the automation with ridicilously strict policies.

We use Go for some of our more vital backend parts. We mainly use Python for entirely different reasons, but since we're an energy company it's nice to have a standard library that can do everything without any sort of external dependencies. It's not because we have some sort of "not invented here" fetish, it's because we have to write and maintain a literal fuckton of complaince documents for every external dependency we use and it's already a full time job for just for Python in our information security department.

ruicraveirotoday at 9:36 AM

I tend to use whatever I perceive to be the most fitting library for each of those concerns (except ORM), but not complete frameworks.

whstltoday at 1:04 PM

Most projects I see use the standard library for almost everything, but everyone leverage a few libraries here and there for one thing or the other.

It's just a different philosophy, but it's really not unlike Rails users importing Devise or Sideqik or RSpec.

phillmvtoday at 3:23 PM

>Are Go backend building custom auth, admin, DB ORM/migrations/auto migrations, templates, email, dev server etc for each project?

lmao, basically, yes. except when you bring this up ppl think it's not a big deal / a means for self-expression. having to sort through which libraries you prefer to glue together is a kind of freedom, if you squint hard enough.