This week covers the foundational concepts needed to start writing Go programs.
Compilation and Execution
Running Code
go run compiles and runs immediately (no saved binary).go build compiles and produces a reusable executable.Program Structure
package main to be executable.func main() is the single entry point; it takes no arguments and returns nothing..go files in a directory form one package.Types and Variables
var declares explicitly; := declares + assigns inside functions only.int, string, bool.Control Flow
if requires a boolean condition; no truthy/falsy values.for is the only loop construct (classic, while-style, infinite).for init/condition/post each allow exactly one expression.Code Standards
gofmt / go fmt.gofmt enforces structure, not personal spacing preferences.Modules
go.mod file.go mod init is run once per project; optional for throwaway snippets.Functions
main; main should only orchestrate.nil means no error.Collections
[]T{...}.len(x) returns how many values are in a group.for _, v := range group._ is used to ignore a value you don't need.Design Patterns
main.Continue working through exercises in each Day's folder and consolidate learnings from the curriculum.
failure is impossible