Generics in Go
42mIntermediate2023-01-03
Authors

Anna-Katharina Wickert
Developer, Speaker
Course details
Repeating code by writing boilerplate code over and over again can often lead to mistake-ridden, messy code. In this course, Anna-Katharina Wickert shows you how to use generics in Go to write cleaner and easier-to-read code. Anna-Katharina shows how you can use generics—long on developers’ wishlists and introduced in Go 1.18—to write functions and types that work with a set of types instead of one concrete type. She covers type parameters, typesets, and type inference, and puts it all into practice with examples and looks into new packages shipped along with generics.
Skills covered
GoProgramming FoundationsGoogleProgramming LanguagesSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Generics in Go 1.18
- 02 - What you should know
1. Type Parameters
- 03 - Type parameter 101
- 04 - Instantiation of generic functions
- 05 - Challenge - Type parameter with composite type
- 06 - Solution - Type parameter with composite type
2. Type Sets
- 07 - Type set 101
- 08 - Define type sets
- 09 - Experimental package - Constraints
3. Type Inference
- 10 - Function argument type inference
- 11 - Constraint type inference
4. Generics in Practice
- 12 - Best practice for usage
- 13 - Experimental package - Slices
- 14 - Experimental package - Maps
- 15 - Known limitations
Conclusion
- 16 - Next steps
Related courses
- Java: Generic Classes
- Transition from Java to Go
- .NET MAUI: Beyond the Basics
- Advanced Java: Hands-on with Streams, Lambda Expressions, Collections, Generics and More
- TypeScript: Object-Oriented Programming
- C# Essential Training 2: Generics, Collections, and LINQ
- Writing: The Craft of Story
- Advanced TypeScript Concepts