RANIARANIA Academy

Functions, Packages & Modules

Learn to structure Go code into reusable pieces — functions with multiple returns, closures, variadics and defer, then packages and modules that organise and version your code. You will finish able to split a program into clean, importable packages and manage its dependencies with go modules.

Watch the free preview

Functions, parameters and multiple return values — free to watch, no account needed.

Go (Golang) BEGINNER · 150 min · Certificate on completion · 3 CPD points

What you'll learn

  • Structure Go code into reusable pieces using functions, packages and modules
  • Write functions with multiple return values, closures and variadic parameters
  • Use defer to guarantee cleanup runs even when a function returns early
  • Create packages with exported and unexported identifiers and document them idiomatically
  • Initialise a go module, add a versioned dependency and tidy the module graph

Syllabus

Functions — the Core Building Block
Functions, parameters and multiple return valuesFree preview15 min
Function values and closures15 min
Flexible Functions — Variadics and defer
Variadic functions15 min
defer, and guaranteed cleanup15 min
Packages — Organising Code
Creating packages, exported vs unexported15 min
Documentation conventions and go doc15 min
Modules — Versioning and Dependencies
Go modules and versioning15 min
Adding and tidying dependencies15 min
Lab — 10 Exercises & Solutions
Exercises 1–515 min
Exercises 6–1015 min