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.
-
Install Go using package manager or following the instructions at https://golang.org/doc/install
-
Install
ginkgo
andgomega
:
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega/...
- Run the tests:
ginkgo -r -v
-
Read the tests and implementation to dive deeper.
-
Experiment with the code.