Go – Generic Programming (GO3)

Programming, Rust

This course teaches how to build reusable, type-agnostic code using Go's generics model introduced in Go 1.18. You will learn to design generic functions, declare type parameters, and apply constraints and interfaces to create robust collections, utilities and APIs.

Hands-on exercises focus on implementing generic collections, common utilities and API design, comparing Go's approach with C++/Rust. You will practice type inference, debug compiler errors, measure performance and binary impact, and apply idiomatic workarounds.

THIS TRAINING COURSE WILL HELP YOU:

  • Learn Go type parameter syntax and rules (Go 1.18+)
  • Design and implement generic functions and types
  • Create constraints and custom type sets for APIs
  • Combine generics with interfaces and API design choices
  • Debug inference issues and optimize performance and tests

WHO SHOULD ATTEND?

  • Backend developers working with Go
  • Library and framework authors in Go
  • DevOps and system engineers writing shared utilities
  • Software architects designing type-safe APIs

COURSE LOCATION AND AVAILABLE DATES



Public courses are usually delivered in Czech, but this course is also available in English. We can arrange private training for your team online, at your premises or in our classrooms, and tailor the content to your needs.

For groups of around 4 or more participants, private training can already be comparable in price to booking individual places on a public course. Send us your requirements and we’ll recommend the best format and provide an exact quote.

Request training in English

Course content:

Hide details
  • Introduction to generics (Go 1.18+)
    1. Syntax of type parameters, constraints (~, |, type sets)
    2. Built-in constraints (comparable, any) and custom constraints
  • Generic functions and types
    1. Writing general utilities (Min/Max, filters, transforms)
    2. Generic collections and algorithms (sorting, searching)
    3. Type composition and methods on generic types
  • Interfaces and generics
    1. Connecting interfaces and type parameters, API design
    2. When to choose interface-based polymorphism vs generics
  • Errors and inference
    1. Type inference vs explicit types, readability and compile errors
    2. Generics limitations in Go and idiomatic workarounds
  • Performance and readability
    1. Impact of generics on binary size and runtime performance
    2. Maintainability, documentation and tests (table-driven with types)
Prerequisites:
Basic experience with Go and familiarity with Go 1.18+ features.
Recommended previous course:
Go – Advanced Techniques (GO2)
Recommended follow-up course:
Go – parallel programming (GO4)
Schedule:
3 days (9:00-17:00)
Language:
Česky

Training and learning environment