Copy code from golang-fanout repository