golang: How to `go get` private repos

Recently, I’ve been working on some golang projects at DataSift that depend on some private modules. This means that when I run go get to fetch the module, Github asks me for my username and password. Unfortunately, as I use 2FA I need to generate a new, temporary password for applications that want my password. As go get doesn’t cache credentials, I’d have to do this every time I needed a private repo. Instead, I wanted to force go get to use my SSH key.

Fortunately, as go get uses git, you can change your .gitconfig to force it to use SSH.

$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
    insteadOf = https://github.com/

Here, we say use git@github.com any time you’d use https://github.com. This works for everything, not just go get. It just has the nice side effect of using your SSH key any time you run go get too.

Golang: Using Memcached

If you want to use memcached in a Golang project, the most recommended library is is memcache from Brad Fitzpatrick. Brad is both the author of memcache and a Golang core team member, which means that we can trust the library that he wrote.


First, we need to install the library:

go get github.com/bradfitz/gomemcache/memcache


Here’s the miinimum you need to know to use memcached

Connect to memcache
    mc := memcache.New("")
    // => memcache.Client (http://godoc.org/github.com/bradfitz/gomemcache/memcache#Client)
Set a value
    err := mc.Set(&memcache.Item{Key: "key_one", Value: []byte("michael")})
    // => Error
Get a value
    val, err := mc.Get("key_one")
    // => memcache.Item, Error
Get multiple values
    it, err := mc.GetMulti([]string{"key_one", "key_two"})
    // => map[string]memcache.Item, Error

Putting it all together

Then we can write a small program to talk to our memcached server

package main

import (


func main() {

    // Connect to our memcache instance
    mc := memcache.New("")

    // Set some values
    mc.Set(&memcache.Item{Key: "key_one", Value: []byte("michael")})
    mc.Set(&memcache.Item{Key: "key_two", Value: []byte("programming")})

    // Get a single value
    val, err := mc.Get("key_one")

    if err != nil {

    fmt.Printf("-- %s", val.Value)

    // Get multiple values
    it, err := mc.GetMulti([]string{"key_one", "key_two"})

    if err != nil {

    // It's important to note here that `range` iterates in a *random* order
    for k, v := range it {
        fmt.Printf("## %s => %s\n", k, v.Value)


The return values from memcache will be wrapped in a memcache.Item type. You can find the documentation that shows it’s properties here

Potential wifi network names

Just saving this list here for later. This time around, we opted for LAN Solo and Pretty fly for a wifi, but I do like the rest too.

So, possible names for future networks:

  • Pretty Fly for a Wifi
  • Troy and Abed in the Modem
  • Tell my Wifi love her
  • LAN Solo
  • Abraham Linksys
  • Silence of the LANs
  • Routers of Rohan
  • Winter-net is coming
  • Wu Tang Lan