golang-pitfalls-standard-library

Installation
SKILL.md

Golang Pitfalls: Standard Library

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

Apply these rules when working with the Go standard library.

75. Providing a wrong time duration (#75)

  • time.Duration is an alias for int64; one unit = one nanosecond (not a millisecond).
  • time.NewTicker(1000) ticks every 1000 ns = 1 µs, not 1 second.
  • Always express durations through the time API: time.Second, 1000 * time.Nanosecond, time.Millisecond. Avoid raw numbers.

76. time.After and memory leaks (#76)

  • Not relevant anymore from Go 1.23 — the internal timer implementation was fixed. On older Go versions, time.After inside a loop kept timers alive until fired; use time.NewTimer/time.NewTicker with defer Stop() if you target pre-1.23.

77. JSON handling common mistakes (#77)

Installs
2
First Seen
9 days ago
golang-pitfalls-standard-library — fabianoflorentino/golang-agent-skills