class: title, smokescreen, shelf, no-footer background-image: url(I_pOqP6kCOI.jpg)

Code Like the Go Team

Gophercon Russia 2018

About This Talk

About Me

  • Microsoft Azure - Cloud Developer Advocate
  • Using Go since 2010
  • Twitter: @bketelsen
  • Github: bketelsen
  • Podcast:
  • Email:

This Talk

History of Building Go

  • 2009 6g, 6l - Makefiles
  • 2010 goinstall
  • 2011 go command
  • 2014
  • 2014 semver proposal
  • 2015 go 1.5 vendor experiment
  • 2013-2018 godep,glide,gb,others






Defines Go Modules


Proposed Modification to “go” Tool


  • The Import Compatibility Rule
  • Minimal Version Selection
  • Semantic Import Versioning
  • Graceful API Updates
  • Reproducible Builds
  • Verifiable Builds
  • Verified Builds
  • Proxy Server Support

The Import Compatibility Rule

If an old package and a new package have the same import path, the new package must be backwards-compatible with the old package.

Minimal Version Selection

Minimal version selection allows modules to specify only minimum requirements for their dependency modules.

class: img-caption Semantic Versions

Semantic Import Versioning

Graceful API Updates

class: col-2

Graceful API Updates

package p // v1
import v2 "p/v2"

func EnableFoo() {
func DisableFoo() {

(v1 package imports v2, allows you to set compatibility defaults.)

(Future “go fix” commands will inline the changes.)

Reproducible Builds

Dependencies specified in go.mod

Reproducible Builds

module "" //Module Declaration

# Dependencies, with version specified
require (
	"" v0.0.0-20160226214623-1ea25387ff6f
	"" v1.6.0

Verifiable Builds

Inspect dependencies in compiled binary

Verifiable Builds

goversion -m captainhook               //
captainhook go1.10                     // binary name, go version 
  path // import path
  mod  (devel) // mod declaration
  dep            v1.6.0 // deps + version

Verified Builds

Version hashes listed in go.modverify

Verified Builds v1.6.0 h1:UykbtMB/w5No2LmE16gINgLj+r/vbziTgaoERQv6U+0=

Verified Builds

$ vgo verify
all modules verified

Verified Builds

$ vgo verify v1.6.0: dir has been modified (...)



Change “go get” to make packages self-contained

Change Build Sources



Getting Started

  • Add VCS tags to your releases
  • Add go.mod file to your repository
  • There is no step three

Example with Makefile

Captain Hook

Proxy Server Support

$ GOPROXY= vgo build

Proxy Server




  • Open Source Proxy Server
  • Multiple Storage Options
  • Well Defined Go Interface

Coming Soon ™

  • Globally Distributed Proxies
  • Hosted Registry

Hosted Registry

  • Combines Proxy with Vanity Domains
  • Automatically updates from VCS
    • Push tag, registry updates
  • Adds extra metadata
    • scorecards
    • version history
    • import counts

Hosted Registry

  • Separate module from VCS
  • Insulate package from Github control

Hosted Registry


Hosted Registry *

Coming Soon

Global Proxies

  • Athens running on multiple clouds
  • Multiple Hosting Companies
  • In geographically varied regions
  • Synchronized content
  • Global reach, Fast Builds!!

Open Source


twitter: @bketelsen

github: bketelsen

github: gomods

class: img-caption Thank You

Thank You