Generic event emitter/dispatcher in Go

Go doesn’t support generics, one can use go generate, but writing code for that is a pain. Instead we can tinker with reflection to manipulate types and channels. This allows us to create neat event dispatcher with user friendly handler registration and somewhat reasonable event registration. Event emitters are pretty popular in OOP languages which support generics, but of course Go is not one of them. We will try to achieve something similar without generic types....

December 26, 2015 · 6 min

Parsing HTML with Go using stream processing

Over a month ago I’ve created a handy tool to create sitemaps only with URLs matching specific rules. I want to talk about problems and challenges I faced, but mainly explain the art of stream processing. Data scraping and more precisely web scraping involves parsing documents which access to is often quite slow. More often than not the flow looks like this: Make a request Parse whole body into html....

November 22, 2015 · 4 min