Generics in Go

An example of a function calculating smaller of two numbers.

First it was implemented in terms of non-generic types, then Golang's generic types were used to learn how they work and test limitations.

Installation

  1. Install Go using package manager or following the instructions at https://golang.org/doc/install

  2. Install ginkgo and gomega:

go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega/...

Usage

  1. Run the tests:
ginkgo -r -v
  1. Read the tests and implementation to dive deeper.

  2. Experiment with the code.