Features of Go
Start with Features of Go
Go prioritizes readable syntax, a fast feedback loop, useful standard libraries and practical concurrency support. These features work together: a small program can grow without requiring complicated language constructs.
What you’ll learn
- Describe Go’s static typing and garbage collection.
- Recognize practical tooling and library features.
- Avoid confusing concurrency with guaranteed parallelism.
Understand the idea
Static typing means the compiler knows the types of expressions and rejects incompatible operations. Garbage collection automatically reclaims memory that the program no longer needs. Goroutines allow functions to run concurrently; you will explore them in a later module.
Go also provides one standard formatting tool (gofmt), a built-in test command (go test) and convenient cross-platform builds. These are engineering benefits, not promises that every Go program is automatically fast or safe.
Visualize how it works
Follow this diagram before executing the example. Check where a value or decision changes what runs next.
Run a complete Go example
This example is a complete program. Save it as main.go or paste it into the Go Playground.
Go code
package main
import "fmt"
func main() {
names := []string{"Ava", "Sam", "Lia"}
for _, name := range names {
fmt.Println("Welcome,", name)
}
}
Output
Welcome, Ava
Welcome, Sam
Welcome, LiaTrace what the program does
The compiler infers names as a slice of strings. The range loop visits each element and prints a greeting. We use this example to preview concise syntax; slices and loops will be covered carefully later.
Avoid common mistakes
- Strong typing does not mean a program cannot have logical mistakes.
- Concurrency is different from parallel execution; goroutines do not guarantee every task uses a separate CPU core.
Try it yourself
Add a fourth name. Decide which parts of the example illustrate readability, type inference and standard-library reuse.
Tip: Edit the example above, predict the output, and run the modified code to test your reasoning.
Check your understanding
What you should remember
You have practiced Features of Go in a small, self-contained program. The important habit is to predict what runs, inspect the actual output and distinguish the language rule from the particular example.
Before continuing, make sure you can explain the program to someone who has not seen it, including the line that changes its result.
Reaching the recap and completing the quizzes are separate milestones.