Skip to content
Go gotchas, surprises, puzzles.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Go gotchas, surprises, puzzles.

Other lists and articles:

Other gotchas and questions

Embedded struct literal

The JSON unmarshaler works with embedded struct, while literal initialization will not.

prog.go:31:13: cannot use promoted field A.A1 in struct literal of type B

Missing high index causes out of range

The high index of a slice is not what it seems.

panic: runtime error: slice bounds out of range
You can’t perform that action at this time.