Posts with the tag golang:

Go dep in Docker

Go’s dependency handling has been an area which has been needing unification, over the years. Multiple package managers have been created. The Go community has been working on creating a dependency manager recently, which they plan on getting added to the official toolchain. I’ve decided to jump on the bandwagon and start using this tool. Here’s how I’ve been using it in docker.

Revel : Force template format

So in Revel you can have your template in several different formats: html, json, xml, or txt. This is super awesome. As it allows you to send the same data and display different formats - Obivously. It also determines what template to use based on the http request headers that have been sent. So if your request sends that it accepts application/xml it’ll use xml and if you request says application/json it uses json.

Observer pattern in golang

For some reason at some point, I thought it would be hard to implement the observer pattern in Go. Then I made an issue for me to blog about it. Well it’s not hard. It’s as easy as it is in every other language. Observers First part of the observer pattern is you need the actual observers. The logic that you want executed whenever something happens. Here I’ve just put a simple log print statement that will print out the name of the hook to the log.