Added a Go implementation (with tests)