Flashcards · Go · Free
Go flashcards, generated for you.
Example Go study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example Go flashcards
What is the syntax for declaring a variable in Go?
Use 'var name type' for explicit declaration, or 'name := value' for short declaration (inside functions only). Example: var x int = 5 or x := 5
What is the zero value in Go?
The default value assigned to uninitialized variables: 0 for numeric types, false for bool, empty string for string, and nil for pointers/slices/maps/interfaces.
What's the difference between 'var' and ':=' in Go?
':=' is short declaration (only inside functions, type inferred). 'var' works at package scope, allows explicit type specification, and can declare multiple variables at once.
How do you create a slice in Go?
Use slice literal syntax: s := []int{1, 2, 3} or make([]int, length, capacity). Slices are dynamic arrays with length and capacity properties.
What's the gotcha with slice assignment in Go?
Slices are passed by reference to underlying array. Modifying a slice modifies the original array. Use copy(dest, src) to create independent copies.
How do you defer function execution in Go?
Use 'defer functionName()' to schedule execution after the enclosing function returns. Deferred calls execute in LIFO order. Commonly used for cleanup (closing files, unlocking mutexes).
What's the gotcha with error handling in Go?
Go returns errors as values, not exceptions. Always check 'if err != nil' immediately after operations. Ignoring errors silently is a common mistake.
How do you launch a goroutine in Go?
Prefix a function call with 'go': go functionName(). Goroutines are lightweight threads managed by the Go runtime. Use channels to communicate between goroutines.
What happens if you don't wait for goroutines in Go?
The program may exit before goroutines complete, losing their results. Use sync.WaitGroup, channels, or context.Context to synchronize goroutines with the main function.
What's the difference between buffered and unbuffered channels in Go?
Unbuffered channels (ch := make(chan Type)) block until both sender and receiver are ready. Buffered channels (make(chan Type, n)) can hold n values without blocking. Sending on full/closed channel panics.
Make your own Go study set
Flashcards for related topics
Studying Go to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →