A quick-reference guide for Go programming
Go is a statically typed, compiled language designed at Google for simplicity, performance, and concurrency. It is widely used for cloud services, microservices, CLI tools, and DevOps tooling.
Version Go 1.21+ Paradigm Procedural, Concurrent Typing Static
var x int = 10 or short form x := 10int, float64, string, bool,
byte, rune:=if / else if / else (no parentheses required)for — only loop construct (covers while too)switch — no fallthrough by defaultdefer — runs at function endfunc divide(a, b int) (int, error)...goroutine — lightweight threads with go func()channel — typed communication between goroutinesselect — multiplex channel operationssync.WaitGroup, sync.Mutex for synchronizationcontext package for cancellation| Category | Package / Tool |
|---|---|
| Web | net/http, Gin, Echo, Fiber |
| Testing | testing, testify |
| Database | database/sql, GORM |
| CLI | cobra, flag |
| Build/Deploy | go build, go mod, Docker |
if err != nil)