So far every program we’ve written lives entirely inside main. Real programs split work into reusable pieces. This section covers Go’s three tools for building and organizing behavior:
What’s in this section
- Functions — named, reusable blocks of logic with inputs and outputs
- Methods — functions attached to a type, the closest Go gets to “object methods” in other languages
- Interfaces — Go’s quietly powerful way of saying “any type that behaves like X”
If you’ve used languages with classes (Java, C++, Python), Go’s approach will feel surprising. There are no classes, no inheritance, no this keyword. There are functions, methods, and interfaces — and that’s all you need.