Basics
The concepts you need before patterns make sense in Go.
Packages and modules
Code is organised in packages; a go.mod file defines a module and its dependencies. Exported names start with a capital letter.
package main
import "fmt"
func main() {
fmt.Println("Hello, patterns!")
}Structs and methods
No classes. Methods attach to named types with a value or pointer receiver.
Implicit interfaces
A type satisfies an interface by having its methods; no implements keyword. This makes small interfaces cheap.
Errors are values
Functions return (result, error). Callers check err != nil explicitly; panic is for unrecoverable bugs.
Goroutines, channels, defer
go f() starts a lightweight goroutine; channels pass data between them; defer schedules cleanup when the function returns.
Saved in this browser only. Part of Clean code foundations (0/5).