Mark McGranaghan

Introducing Go by Example

October 11 2012

Today we’re introducing Go by Example, a hands-on guide to Go. Go by Example helps you learn and write Go through annotated example programs.

The site already has several examples, including:

Read on to learn more about why and how we made Go by Example and what’s coming next.

Example-Based Approach

Programmers learn to program by reading and writing programs. Go by Example therefore tries to give you:

We have more than 15 published examples and 70 more in development.


In order to best enable developers to access, use, and re-mix the content, Go by Example is released under a liberal Creative Commons license.

The source code is available on Github and we’ve already merged a pull request from a helpful reader of the alpha version.

Go Everywhere

The Go by Example site is derived almost entirely from .go source files (code + comments), rendered to HTML and served online with a Go toolchain.

For example, here is the line filter Go source and corresponding rendered page.


Go by Example strives to provide the best experience possible for developers learning Go:

We hope you find Go by Example a joy to read.

What’s Next

Go by Example is an early experiment. We’re interested in learning how developers find it useful, evolving the model, and shipping more examples that benefit developers.

If there’s an example you’d like to see or if you have any other feedback, let us know at @gobyexample or email the author at

We’re excited to share Go by Example and hope that you check it out.

To learn about new examples and other updates on the site, follow @gobyexample.