dep 101

I’ve had the pleasure of working with several other gophers the last few months on a prototype dependency management tool named dep. dep is part of the project started last year and is organized by Peter Bourgon. I was asked to join the team working on this project due to my involvement in a different tool, godep, the OG dependency management tool for Go, (inherited from Keith Rarick) and my work at Heroku serving our customers who use Go. »

State of Go 2016 Survey

Update: See the raw results, a google sheet of the results and/or my Gophercon lightning talk slides. TL;DR: If you are interested in Go please take a few minutes to fill out this survey. I’ll do a follow up with the results. I’ve been wondering what most other gophers are up to these days, what tools are being used, what packages are popular, where are people deploying, etc. Inspired by a slack conversation with Damian Gryski a few weeks ago I started putting together the State of Go 2016 Survey. »

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 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,