On Variable Declarations: Slices

There are several different ways to declare slices in Go. IMO, there is an implied meaning to each of these different ways: var foo []T : Declare a slice that the code is going to start appending an unknown number of items to and/or the number doesn’t matter. var foo = []T{ ... } or foo := []T{ ... } : Where ... is a list of items of type T. »

Author image Edward Muller on #go,

Type, *Type, Receivers & Interfaces

I’ve recently seen a bit of confusion around types, pointers to types, receivers for the two and interfaces. I’m going to try to clarify that confusion a bit with some examples. Given a simple interface named Fooer, a struct type (Bar) that implements it and a simple function (DoFoo()) that accepts a Fooer and calls the interface function like so: When you run the code above you get Fooer: 5 for output. »

Author image Edward Muller on #go,

Deploying Go Apps to Heroku with Docker

This post covers using the heroku docker cli plugin to deploy a Go application to Heroku. Only Linux and MAC OSX are supported until docker-compose supports MS Windows. Prerequisites Docker: Installable via either the toolbox for MAC OSX or via the Linux getting started guide Docker Compose: Included in the Docker Toolbox. Linux instructions are here Free Heroku Account Heroku Toolbelt Heroku Docker CLI Plugin Please take a look at the links above and make sure everything is installed as per the linked instructions. »

Go 1.5's vendor/ experiment

Go versions before 1.5 did not provide any built in method for vendoring packages. The tools that currently exist today (godep, nut and a few others) basically exploit the implementation details of $GOPATH. Go 1.5 however includes a “vendor experiment”. With this experiment go commands will attempt to resolve dependencies in vendor/ directories. Russ Cox explains it fairly well in his commit message: If there is a source directory d/vendor, then, when compiling a source file within the subtree rooted at d, import “p” is interpreted as import “d/vendor/p” if that exists. »

Author image Edward Muller on #go,

Go + Heroku : Hello World

NOTE: Heroku has launched official support for Go. This is a quick start guide to deploying a simple “Hello World” Go web application to Heroku. It is in no way comprehensive, but aims to provide links to supporting documentation. In many ways it is an updated version of the excellent Getting Started With Go On Heroku guide done by Mark McGranaghan. The guide is command line centric and examples assume basic proficiency with a shell on a UNIX (OS X, Linux, etc) operating system. »

Why Apple, not Google?

I’ve been reading a lot of stuff about Apple’s new products this week (Watch, iPhone 6 & Pay). This got me thinking about why I, for the most part, prefer Apple products over Google products. Let me preface this by saying, I use a few Google products, most notably Google Apps (GMail, Docs & Sheets) and Google Maps. But I use them reluctantly. I’m always looking to see if Apple’s Map app has caught up (it hasn’t ◉︵◉). »

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting. Goroutines The first 1⁄2 of Go’s concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. »

Author image Edward Muller on #go,

About Steal

Steal can only be measured when the VM wants to use CPU, but the hypervisor decided to run a different VM. i.e. something like 25% steal means that 25% of the time the vm was doing nothing when it really really wanted to do something. »

Author image Edward Muller on #linux,

Firefly QOTD

Fans want to watch their shows. They’ll pay to make that happen. Everything else is mired in entrenched interests. Find a way to make that happen and we’ll all agree that Firefly jumped the shark during its seventh season. Via: http://kickingbear.com/blog/archives/305 »