Knaph
BeginnerGoGolangProgramming Languages+2

Introduction to Go

A hands-on tour of Go for programmers coming from other languages — syntax, types, concurrency, and the standard library, taught by building small working programs.

modules
7
modules
lessons
33
lessons
quizzes
7
quizzes
exercises
22
exercises
Start course →

About this course

Go was designed for programs that need to be simple to read, fast to compile, and safe to run concurrently — which is exactly why it shows up so often in systems programming, networked services, and command-line tools. This course assumes you already know how to program (in Python, JavaScript, or anything similar) and focuses entirely on what's different about Go: explicit error handling instead of exceptions, structs and interfaces instead of classes, and goroutines and channels as the default way to handle concurrency instead of an afterthought bolted on with threads or async/await.

Every lesson runs real code — there's no substitute for watching go run actually do something. By the end, you'll be comfortable reading idiomatic Go, writing small programs and tests of your own, and — since this is also the language used for the code examples in this site's Operating Systems course — ready to follow along there without the language itself getting in the way of the systems concepts.

Course content

1First Contact4 lessons · 4 exercises · 1 quiz
  1. lessonInstalling Go and Hello, World
  2. exerciseHello, World
  3. lessonVariables
  4. exerciseAccount Balance
  5. lessonBasic Types
  6. exerciseFahrenheit to Celsius
  7. lessonConstants
  8. exerciseCircle Area
  9. quizQuiz - Getting Started
2Tooling7 lessons · 1 quiz
  1. lessonAdding Go to Your PATH
  2. lessongofmt
  3. lessongoimports
  4. lessongo vet
  5. lessonstaticcheck
  6. lessongolangci-lint
  7. lessonA Makefile for the Toolchain
  8. quizQuiz - Tooling
3Control Flow and Functions5 lessons · 5 exercises · 1 quiz
  1. lessonIf
  2. exerciseAge Group
  3. lessonFor
  4. exerciseSum to N
  5. lessonSwitch
  6. exerciseFizzBuzz
  7. lessonFunctions
  8. exerciseMin and Max
  9. lessonErrors
  10. exerciseSafe Divide
  11. quizQuiz - Control Flow and Functions
4Composite Types5 lessons · 5 exercises · 1 quiz
  1. lessonArrays
  2. exerciseArray Sum
  3. lessonSlices
  4. exerciseFilter a Slice
  5. lessonSlice Capacity
  6. exercisePreallocate a Slice
  7. lessonMaps
  8. exerciseMap Lookup
  9. lessonStructs
  10. exerciseBirthday
  11. quizQuiz - Composite Types
5Pointers, Methods, and Interfaces3 lessons · 3 exercises · 1 quiz
  1. lessonPointers
  2. exerciseDouble
  3. lessonMethods
  4. exercisePerimeter
  5. lessonInterfaces
  6. exerciseShape Interface
  7. quizQuiz - Pointers, Methods, and Interfaces
6Concurrency3 lessons · 3 exercises · 1 quiz
  1. lessonGoroutines
  2. exerciseGoroutine Squares
  3. lessonChannels
  4. exerciseChannel Sum
  5. lessonSelect
  6. exerciseSelect with Default
  7. quizQuiz - Concurrency
7Packages, Modules, and Testing6 lessons · 2 exercises · 1 quiz
  1. lessonPackages
  2. lessonModules
  3. lessonTesting
  4. lessondefer
  5. exerciseDefer Order
  6. lessonWhen defer Runs, and When It Doesn't
  7. lessonpanic and recover
  8. exerciseSafe Divide with Recover
  9. quizQuiz - Packages, Modules, and Testing

Instructors