Subscribe
Fenix

Technologies, Hacks and Games...

Latest posts

Reading S3 objects in golang without trusting the size check

A HeadObject size check followed by a GetObject is a race: the object can be replaced with a huge one in between. Here is how I read S3 objects in Go with io.LimitReader and one extra byte, so the cap holds no matter what the size check said.

5 min read

Talking to Postgres from Go with pgx and sqlc

Part 2 of the shorty series: Postgres from Go with pgx v5 and sqlc. Type-safe code generated from plain SQL, ON CONFLICT with pgx.ErrNoRows, connection pool settings, a deadlock-free batch transaction and goose migrations embedded in the binary.

8 min read