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



This course is not scheduled as a public course.
It is delivered exclusively as customised training. The content, duration, date, and delivery format are tailored to the customer's requirements and can also be provided in English.

Request customised training

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