An open API service indexing awesome lists of open source software.

https://github.com/rellyson/go-generics-structs

Generics and structs usage example (available in go >=1.18 version)
https://github.com/rellyson/go-generics-structs

generics golang

Last synced: 5 months ago
JSON representation

Generics and structs usage example (available in go >=1.18 version)

Awesome Lists containing this project

README

          

# Golang - Using Generics with Structs

## Motivation
Since version 1.18, Go comes shipped with support for generics. This project aims to exercise the usage of generics and structs, building flexible packages.

## About
A vehicle dealership need a way to manage their inventory. They have three types of vehicles: cars, motorcycles and trucks.
As a solution, we going to implement an inventory. The inventory implementation must have generics types to give a flexible way of managing the inventory and provide an easy implementation for new types of vehicles.

## Links

- [Official generics tutorial](https://go.dev/doc/tutorial/generics)
- [Go 1.18 Release Notes](https://go.dev/doc/go1.18)