September 28th, 2024

Some Go Web Dev Notes

Julia Evans discusses her experience with Go, highlighting improvements in routing, the sqlc tool for SQL queries, SQLite optimization tips, and Go's memory management, praising its simplicity and ease of use.

Read original articleLink Icon
Some Go Web Dev Notes

Julia Evans shares insights from her recent experience developing a website using Go. She highlights improvements in Go 1.22, particularly in routing, which now allows for more streamlined code compared to manual routing. She also discusses the benefits of using sqlc, a tool that generates Go code from SQL queries, reducing boilerplate and simplifying database interactions. Additionally, Evans provides tips for optimizing SQLite, such as using separate database objects for reading and writing to avoid SQLITE_BUSY errors. She notes the introduction of a garbage collection memory limit in Go 1.19, which has helped her manage memory usage in low-resource environments. Evans appreciates Go for its simplicity, ease of deployment, and the ability to quickly resume work on projects after long breaks. She contrasts her experience with Go to her attempts to learn Rails, finding Go's straightforwardness more conducive to her workflow. Overall, she expresses enthusiasm for the new features in Go and encourages developers to stay updated with release notes.

- Go 1.22 improves routing capabilities, allowing for cleaner code.

- sqlc generates Go code from SQL queries, reducing boilerplate.

- Optimizing SQLite involves using separate objects for reading and writing.

- Go 1.19 introduced a memory limit for garbage collection to prevent OOM issues.

- Evans prefers Go for its simplicity and ease of project resumption.

Link Icon 2 comments
By @thunderbong - 7 months
Couple of points I found interesting in the article -

> Also sometimes if I have two tables where I know I’ll never need to do a JOIN beteween them, I’ll just put them in separate databases so that I can connect to them independently.

Never thought of using SQLite like this. Will keep this in mind!

> I’ve tried to learn Rails a couple of times and I really want to love Rails – I’ve made a couple of toy websites in Rails and it’s always felt like a really magical experience. But ultimately when I come back to those projects I can’t remember how anything works and I just end up giving up. It feels easier to me to come back to my Go projects that are full of a lot of repetitive boilerplate, because at least I can read the code and figure out how it works.

Reflects my experience with Rails as well. In contrast to this when I build using Ruby (Roda, Sequel), I never have this problem.