golang-pitfalls-data-types

Installation
SKILL.md

Golang Pitfalls: Data Types

Source material: mistakes #17-29 from 100 Go Mistakes and How to Avoid Them (teivah/100-go-mistakes).

Apply these rules when writing Go code around numeric types, slices, maps, and value comparison.

17. Octal literals confusion (#17)

  • Integer literals starting with 0 are octal (010 == 8 decimal).
  • Use explicit 0o prefix for octal (0o10) to avoid mistakes.
  • Other representations: binary 0b, hex 0x, imaginary i suffix; _ as digit separator (1_000_000_000, 0b00_00_01).

18. Neglecting integer overflows (#18)

  • Compile-time overflow/underflow of constants is an error; runtime overflow/underflow is silent — no panic.
  • This can turn positive additions into negative results. Write your own checks when overflow matters.
Installs
2
First Seen
9 days ago
golang-pitfalls-data-types — fabianoflorentino/golang-agent-skills