Go Tutorial
Course Contents
Go Fundamentals
- Go Introduction
- Installing Go
- Go Get Started (Hello World)
- How Go Works: Compiled and Statically Typed
- Go Modules and go.mod
- The go run, go build, and go install Commands
Go Basics
- Variables and var
- Short Variable Declaration (:=)
- Basic Types
- Constants and iota
- Type Conversion
- Formatting and Printing (fmt)
Control Flow
Functions
- Functions in Go
- Multiple Return Values
- Named Return Values
- Variadic Functions
- Functions as Values and Closures
- Anonymous Functions
Arrays, Slices, and Maps
Structs and Methods
Pointers and Memory
- Pointers in Go
- Passing by Value vs by Reference
- The new and make Functions
- Stack vs Heap and Escape Analysis
Interfaces
- Interfaces Explained
- Implicit Interface Satisfaction
- The Empty Interface (any)
- Type Assertions
- Type Switches
- The Error Interface
Error Handling
- Error Handling in Go
- Creating Custom Errors
- Wrapping Errors with fmt.Errorf and %w
- errors.Is and errors.As
- When to panic vs Return an Error
Concurrency: Goroutines
Concurrency: Channels
- Channels Explained
- Buffered vs Unbuffered Channels
- select Statements
- Worker Pools
- Context for Cancellation
Packages and Modules
- Organizing Code into Packages
- Exported vs Unexported Identifiers
- Importing Packages
- The Standard Library Tour
- Third-Party Modules and go get
Testing
Go for Web and I/O
- Reading and Writing Files
- JSON Encoding and Decoding
- Building an HTTP Server with net/http
- Handling HTTP Requests and Routing
- Making HTTP Requests with net/http Client
