Posts

Easy round robin with net/http

By Chee Leong Introduction Golang came bundled with a pretty comprehensive HTTP Standard Library a.k.a net/http. I’m going to show you how to do a simple round robin HTTP server with Golang’s Duck Typing a.k.a Handler interface. And because Golang Playground doesn’t work well with HTTP server, I’m not going to provide the link, so you have to download the script and run it yourself. Basic So, let’s start with the boilerplate we’re going to use for the rest of the guide.

Multiplexing fizzbuzz

By Chee Leong I’m trying to show the common pattern of multiplexing via gochannel and goroutine. Definition Fizz buzz is a group word game for children to teach them about division.[1] Players take turns to count incrementally, replacing any number divisible by three with the word "fizz", and any number divisible by five with the word "buzz". Attention! Go Playground operation is single threaded hence output is always in order of the input.

How to contribute

By Chee Leong Installation Install Hugo or if you have Golang setup, go get -u -v github.com/spf13/hugo Clone the project repository. If you’ve obtained permission to write to the repository. git clone --recursive [email protected]:golang-my/golang-my.github.io-hugo.git Else you’ll have to fork the repository, remember to add --recursive when checkout. I prefer the fork method. :) You can start this to preview the site. Any changes you made will be reflected. hugo server The directory structure, for most the time, you only need to deal with content/post and static (if images are involved).