golang-cheat-sheet
An overview of Go syntax and features.
A single-page Go language reference with short annotated code examples covering variables, functions, loops, collections, structs, interfaces, errors, and concurrency, for developers coming from another language.
This is a reference sheet for the Go programming language, aimed at developers who already know another programming language and want a quick overview of Go's syntax and features without reading through a full tutorial or book. It covers the core language in one long document with short, annotated code examples throughout.
The sheet is divided into numbered sections. It starts with the basic building blocks: how to declare variables and constants, how to write functions, and the built-in data types. Go has some distinctive behaviors that the sheet highlights, such as the ability to return multiple values from a single function, a single loop keyword (for) that covers all looping patterns, and uppercase versus lowercase naming as the mechanism for controlling what code is visible outside a package.
It then moves into collection types (arrays, slices, and maps), Go's approach to structs and interfaces in place of traditional classes, how Go represents and passes around pointers, and how to work with errors. The final sections cover concurrency, which is one of Go's most talked-about features: goroutines are described as lightweight units of work that can run alongside each other, and channels are the mechanism those goroutines use to pass data between themselves safely.
The source material for most of the code examples came from the official Go Tour, which is an interactive introduction maintained by the Go team itself. The README credits that tour and recommends newcomers start there rather than with this sheet.
The repository is a single reference document with no software to install or run. It is useful for quick lookups once you have some Go familiarity, not as a first introduction to programming concepts. No license is specified in the README.
Where it fits
- Quickly look up Go syntax and idioms while learning the language without reading a full book.
- Reference how goroutines and channels work when writing concurrent Go code.
- Compare Go's approach to structs and interfaces against the class-based patterns you know from other languages.