Skip to content

Posts

Go: Validate UTF-8 before counting runes

A Go string can contain arbitrary bytes.

Read more →

November 14, 2026

Go: Split host and port without breaking IPv6 addresses

An IPv6 address contains colons, so splitting an endpoint at every colon loses its structure.

Read more →

November 14, 2026

Go: Report the source position of an invalid CSV field

A CSV record can span physical lines, and a non-ASCII field can occupy several bytes per character.

Read more →

November 14, 2026

Go: Remove one exact prefix and verify it was present

A line beginning with `id:` has a specific marker, not a set of removable characters.

Read more →

November 14, 2026

Go: Quote diagnostic values without embedding raw newlines

A diagnostic value containing a newline can make one event look like two lines.

Read more →

November 14, 2026

Go: Find the first sorted value that meets a threshold

A sorted capacity table can answer which entry first meets a requested size.

Read more →

November 14, 2026

Go: Distinguish an absent regexp group from an empty match

In a small key/value grammar, `name` and `name=` can mean different things.

Read more →

November 14, 2026

Go: Distinguish an absent header from a truncated header

A four-byte protocol header can arrive in several reads.

Read more →

November 14, 2026

Go: Choose a JSON payload type after reading its envelope

A message envelope can identify how its payload should be decoded.

Read more →

November 14, 2026

Go: Check errors when flushing buffered output

A successful write to a buffered writer may only mean that bytes entered its memory buffer.

Read more →

November 14, 2026