sqlc is a great code generator that seems to work miracles.
It uses the official postgres parser to know all the types of your tables and queries, and can generate perfect Go structs from this.
It even knows your table and field types just from reading your migrations, tracking changes perfectly, no need to even pg_dump a schema definition.
I also found it works fine with cockroachdb.