Why I Switched to Hugo

Last weekend I converted my website (the one you’re looking at) to the Hugo Static Website Engine. If you don’t already know, a static website engine converts a directory structure of (usually) Markdown files to a set of HTML files that can be uploaded to a static web server like Surge.sh. I’ve grown fond of Hugo over the past few days so I thought share a few of the things I like and dislike about it.

Continue Reading

Generators in Go

While Go does not have an official construct for generators, it is possible to use channels to achieve the same effect. Below is a function called count that generates numbers from 0 to n. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~// // Generator that counts to n // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~// func count(n int) (chan int) { ch := make(chan int) go func () { for i := 0; i < n; i++ { ch <- i } close(ch) }() return ch } func main() { for i := range count(10) { fmt.Println("Counted", i) } } As you can see, our main function can now use count like a generator without needing to handle channel creation.

A Simple Web Scraper in Go

In my day job at Sendwithus, we’ve been having trouble writing performant concurrent systems in Python. We’ve come to the conclusion that Python just isn’t suitable for some of our high throughput tasks, so we’ve started playing around with Go as a potential replacement. After making it all the way through the Golang Interactive Tour, which I highly recommend doing if you haven’t yet, I wanted to build something real. The last task in the Go tour is to build a concurrent web crawler, but it faked the fun parts like making HTTP requests and parsing HTML.

Continue Reading