Go (Golang) Tutorial
A complete Go programming path from beginner to pro - syntax, concurrency, APIs, databases, testing, and real projects. Clear, practical, section by section.
Curriculum
Work through each section in order. Every lesson ends with practice and key points so the idea sticks.
Getting Started
- 1What is Go (Golang)?
Learn what Go is, why developers use it, and what kinds of programs beginners can build with it.
9 min - 2Install Go & Set Up Your Editor
Install modern Go, check your terminal, and prepare an editor for beginner-friendly Go development.
11 min - 3Your First Go Program
Write, save, and run a small Go program using package main, imports, and fmt.Println.
10 min - 4Go Modules & go.mod
Understand Go modules, create a go.mod file, and learn why modules are the default for modern Go projects.
12 min - 5go run, build, fmt & Tooling
Use the most important Go commands for running, building, formatting, testing, and inspecting beginner projects.
12 min
Foundations
- 6Variables & Short Declaration
Learn how to create variables with var, short declaration, type inference, and assignment.
11 min - 7Basic Types
Understand Go basic types including strings, integers, floats, booleans, and how to inspect them.
12 min - 8Constants & iota
Use constants for fixed values and learn how iota can create simple related numeric constants.
10 min - 9Operators
Learn Go arithmetic, comparison, logical, and assignment operators with practical examples.
10 min
Working with Data
- 10Strings & Runes
Work with Go strings, string length, indexing, raw strings, and Unicode runes.
13 min - 11Arrays & Slices
Learn the difference between fixed-size arrays and flexible slices, including append, len, cap, and range.
14 min - 12Maps
Use maps to store key-value data, check for missing keys, update values, and delete entries.
13 min
Control Flow
Functions & Scope
- 15Functions
Write reusable Go functions with parameters, return values, and clear names.
12 min - 16Multiple Return Values
Learn how Go functions return more than one value and why this pattern is central to error handling.
11 min - 17Pointers
Understand what pointers are, how to use &, *, and when pointer parameters are useful.
14 min
Types & Composition
- 18Structs
Group related fields into custom struct types for users, orders, products, and service data.
13 min - 19Methods
Attach functions to types with methods and understand value and pointer receivers.
13 min - 20Interfaces Intro
Learn the beginner idea behind Go interfaces: behavior described by method sets.
14 min
Project Basics
- 21Packages & Imports
Organize Go code into packages, import standard library packages, and understand exported names.
13 min - 22Error Handling the Go Way
Handle errors explicitly with error return values, nil checks, and clear control flow.
14 min - 23defer, panic & recover
Use defer for cleanup and understand when panic and recover appear in Go programs.
13 min - 24fmt, input & basic I/O
Print formatted output, read beginner terminal input, and understand basic standard input/output ideas.
14 min
Putting It Together
Stronger Go
- 26Interfaces in Practice
Use Go interfaces to design small contracts, accept behavior instead of concrete types, and keep packages easy to test.
12 min - 27Embedding & Composition
Build larger Go types by composing smaller structs and interfaces instead of relying on inheritance.
11 min - 28Generics Basics
Write reusable Go functions and types with type parameters while keeping constraints simple and readable.
13 min
Concurrency
- 29Goroutines
Run functions concurrently with goroutines and understand how lightweight concurrent work differs from parallel execution.
12 min - 30Channels
Communicate between goroutines with channels, including sends, receives, buffering, closing, and range loops.
14 min - 31select Statements
Wait on multiple channel operations and implement timeouts, cancellation, and non-blocking communication.
12 min - 32sync Package (WaitGroup, Mutex)
Coordinate goroutines with sync.WaitGroup and protect shared data with sync.Mutex.
14 min - 33context Package
Use context.Context to carry cancellation, deadlines, and request-scoped values through Go programs.
14 min
Quality
- 34Testing with testing package
Write focused Go unit tests using the standard testing package, test file naming, and helpful assertions.
12 min - 35Table-Driven Tests
Use table-driven tests to cover many inputs clearly with less repetition and better failure names.
11 min - 36Benchmarks & Coverage Basics
Measure Go code with benchmarks and use coverage reports to see which lines your tests execute.
13 min
Data & I/O
Networking
- 39HTTP Client
Make outbound HTTP requests with net/http, timeouts, context, headers, JSON decoding, and response handling.
14 min - 40net/http Server Basics
Create HTTP handlers, write responses, parse requests, and run a server with sensible timeouts.
14 min - 41Routing Patterns
Organize routes with ServeMux, method checks, path parameters, route groups, and lightweight router libraries.
12 min - 42Middleware Patterns
Wrap HTTP handlers to add logging, recovery, authentication checks, request IDs, and shared behavior.
13 min - 43Building a REST API
Combine routing, JSON, validation, handlers, and status codes to build a small REST API in Go.
16 min
Persistence
App Structure
- 46Env Vars & Configuration
Load application configuration from environment variables with validation, defaults, and safe secret handling.
11 min - 47Structured Logging
Use Go 1.21 log/slog for structured logs that are readable locally and useful in production systems.
12 min - 48Standard Project Layout
Organize Go applications with packages, cmd directories, internal code, configuration, tests, and migrations.
13 min
Deep Go
- 49Concurrency Patterns (worker pools, pipelines)
Use goroutines, channels, context cancellation, worker pools, and pipelines to build practical concurrent Go programs.
18 min - 50Performance Mindset & Profiling
Learn how to improve Go performance with measurement, benchmarks, pprof, allocation awareness, and practical optimization habits.
18 min - 51Memory & Garbage Collector Basics
Understand stack vs heap, escape analysis, garbage collection, slices, memory retention, and safe memory habits in Go.
16 min - 52Reflection (When You Really Need It)
Use the reflect package carefully for struct tags, generic utilities, validation, and framework-style code.
15 min
Production
- 53Security Essentials for Go Services
Protect Go services with secure HTTP defaults, validation, parameterized SQL, secrets management, timeouts, and safe error handling.
18 min - 54Dockerizing Go Apps
Package Go services with multi-stage Docker builds, small runtime images, environment configuration, and container-friendly practices.
16 min - 55Deploying Go Services
Prepare Go services for production deployment with config, graceful shutdown, health checks, migrations, logging, metrics, and release discipline.
17 min - 56gRPC Intro (Conceptual + Small Example)
Understand where gRPC fits, how Protocol Buffers define APIs, and what a small Go gRPC service looks like.
16 min
Pro Architecture
- 57Structuring Larger Go Services
Organize larger Go codebases with clear packages, dependency direction, small interfaces, config, handlers, services, repositories, and tests.
18 min - 58Advanced Tooling (vet, staticcheck mindset)
Use Go tooling like gofmt, go test, go vet, staticcheck, govulncheck, race detection, coverage, and CI as a production quality system.
14 min
Capstone Projects
- 59Mini Project: Task CLI
Build a small task manager command-line application with modules, JSON persistence, commands, error handling, and a clean file structure.
20 min - 60Mini Project: JSON REST API
Build a small JSON REST API with net/http, routing, JSON helpers, an in-memory store, validation, and curl-based testing.
20 min - 61Mini Project: Background Worker
Build a background worker with a job queue, worker goroutines, retries, context cancellation, graceful shutdown, and structured logs.
20 min
Polish & Next Steps
- 62Common Go Mistakes (and Fixes)
Avoid common Go bugs around nil maps, defer, contexts, goroutines, loop variables, channels, errors, mutexes, and shadowing.
16 min - 63Go Ecosystem & Useful Libraries
Explore the Go ecosystem, standard library strengths, popular libraries, dependency selection, and when to keep things simple.
14 min - 64Building a Go Portfolio
Design portfolio projects that prove production Go skills: APIs, CLIs, workers, databases, tests, Docker, deployment, and clear documentation.
12 min - 65What to Learn After Go
Plan your next growth path after Go: systems design, databases, distributed systems, Kubernetes, observability, security, and open source.
12 min