Go · Starter

The basics: what a thing is and what it's for.

Starter·10.1.1

What does the := operator do in Go?

Starter·10.1.2

In one sentence, what is a goroutine?

Starter·10.1.3

What is the zero value of an int variable that is declared but not explicitly initialized?

Starter·10.1.4

What is the zero value of a string variable in Go?

Starter·10.1.5

What does a declared-but-uninitialized pointer variable hold as its zero value?

Starter·10.1.6

What is the key difference between a Go array and a Go slice?

Starter·10.1.7

What is the practical difference between `go run main.go` and `go build main.go`?

Starter·10.1.8

Why must a Go source file that is meant to be an executable program declare `package main`?

Starter·10.1.9

What does an import statement like `import "fmt"` do?

Starter·10.1.10

What keyword is used to declare a function in Go?

Starter·10.1.11

When would you use `var x int` instead of `x := 0`?

Starter·10.1.12

What is a channel used for, at the simplest level?

Starter·10.1.13

What does the defer keyword do when placed before a function call?

Starter·10.1.14

What does the type `interface{}` (or its modern alias `any`) mean?

Starter·10.1.15

What is the zero value of a map variable, and what happens if you try to write to it in that state?

Starter·10.1.16

What is Go's built-in `error` type actually used for?

Starter·10.1.17

Why might a Go function be written as `func divide(a, b int) (int, error)`, returning two values?

Starter·10.1.18

In Go, how does a package decide whether an identifier (like a function or struct field name) is visible to code in other packages?

Starter·10.1.19

What is the purpose of the go.mod file at the root of a Go project?

Starter·10.1.20

What is the purpose of the `go.sum` file that sits alongside `go.mod` in a Go module?