Subscribe
Fenix

Technologies, Hacks and Games...

Latest posts

Golang Tutorial 11: Methods and interfaces

Methods on your own types, implicit interfaces, small interfaces like io.Reader, type switches, the nil interface trap and "accept interfaces, return structs", with runnable examples on Go 1.27 and a small io.Writer exercise.

8 min read

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