This package implements a binary heap using Go generics. It can store items of any type with specified comparison function.
See test file for examples of usage.
The Go standard library has implementation of binary heap that does not support generics. It is cumbersome to use in practice. It requires to implement your own additional struct and functions, but also requires to use the functions from the standard 'heap' package when working with the heap implemented that way.
As of this writing, there is an open issue to modernize that package in the standard library.