Module 06 of 12

Packages, Modules & Generics

Lessons

About This Module

As programs grow, you need ways to organize code and avoid writing the same logic again and again. Go gives you packages and modules for structure, and generics for writing functions and types that work with many different types while staying type-safe.

This module starts with packages: splitting code into files and folders and importing it where it is needed. It then covers modules, how your own packages fit into a Go project, and finishes with generics, including type parameters and constraints.

Watch the lessons in order and split one of your own small programs into packages as you go, then continue on to Concurrency: Goroutines & Channels.

Lessons

4 videos
01

Introduction to Go packages

What packages are in Go and how they let you split a program into reusable pieces.

02

Golang Tutorial: Modules and Packages in Go

How modules and packages work together, and how to use your own packages inside a Go project.

03

Golang generics in 6 minutes

A quick overview of generics in Go, a good first look before the longer tutorial that follows.

04

Go Generics Complete Tutorial: Master Type Parameters & Constraints in Go 1.18+

A fuller walkthrough of generics: writing functions and types with type parameters, and limiting them with constraints.