News for hackers. Stuff that matters.
Re:Rails adds support for Fiber-safe ActiveRecord Connection... by hellcow on Thursday February 24, 2022 @10:31AM (#30455812)
On small projects, I just write out the boilerplate. It's annoying but it's straightforward to read and revisit years later.

On larger projects (100k LOC+) I use chi for my router in combination with codegen via sqlc and moq, and I wrote a small program to generate the routes for me automatically with a config file.

Re:Rails adds support for Fiber-safe ActiveRecord Connection... by jjice on Thursday February 24, 2022 @10:49AM (#30456050)
sqlc is very interesting. Gives me sqlx (from Rust, not the Go package) vibes. Definitely will play around with this.
Re:Rails adds support for Fiber-safe ActiveRecord Connection... by zinclozenge on Thursday February 24, 2022 @02:30PM (#30459101)
There's a variety of projects out there. gorilla/mux, chi, httprouter are all pretty commonly used for just defining routes. If you want a full on framework, gin and beego are also common. For the database (I'm unfortunately mainly familiar with postgresql related projects) there's pgx, sqlx, gorm, and then code generators like sqlc such as sqlboiler and entgo.

Golang encourages libraries and frameworks with much smaller surface, so there is indeed a boilerplate issue, but that's also an issue with golang as a whole.