• Stars
    star
    7,224
  • Rank 5,374 (Top 0.2 %)
  • Language
    Go
  • Created about 12 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go by Example

Go by Example

Content and build toolchain for Go by Example, a site that teaches Go via annotated example programs.

Overview

The Go by Example site is built by extracting code and comments from source files in examples and rendering them using templates into a static public directory. The programs implementing this build process are in tools, along with dependencies specified in the go.modfile.

The built public directory can be served by any static content system. The production site uses S3 and CloudFront, for example.

Building

test

To build the site you'll need Go installed. Run:

$ tools/build

To build continuously in a loop:

$ tools/build-loop

To see the site locally:

$ tools/serve

and open http://127.0.0.1:8000/ in your browser.

Publishing

To upload the site:

$ export AWS_ACCESS_KEY_ID=...
$ export AWS_SECRET_ACCESS_KEY=...
$ tools/upload

License

This work is copyright Mark McGranaghan and licensed under a Creative Commons Attribution 3.0 Unported License.

The Go Gopher is copyright Renรฉe French and licensed under a Creative Commons Attribution 3.0 Unported License.

Translations

Contributor translations of the Go by Example site are available in:

Thanks

Thanks to Jeremy Ashkenas for Docco, which inspired this project.

FAQ

I found a problem with the examples; what do I do?

We're very happy to fix problem reports and accept contributions! Please submit an issue or send a Pull Request. See CONTRIBUTING.md for more details.

What version of Go is required to run these examples?

Given Go's strong backwards compatibility guarantees, we expect the vast majority of examples to work on the latest released version of Go as well as many older releases going back years.

That said, some examples show off new features added in recent releases; therefore, it's recommended to try running examples with the latest officially released Go version (see Go's release history for details).

I'm getting output in a different order from the example. Is the example wrong?

Some of the examples demonstrate concurrent code which has a non-deterministic execution order. It depends on how the Go runtime schedules its goroutines and may vary by operating system, CPU architecture, or even Go version.

Similarly, examples that iterate over maps may produce items in a different order from what you're getting on your machine. This is because the order of iteration over maps in Go is not specified and is not guaranteed to be the same from one iteration to the next.

It doesn't mean anything is wrong with the example. Typically the code in these examples will be insensitive to the actual order of the output; if the code is sensitive to the order - that's probably a bug - so feel free to report it.

More Repositories

1

services-engineering

A reading list for services engineering, with a focus on cloud infrastructure services
3,612
star
2

clj-stacktrace

More readable stacktraces for Clojure
Clojure
271
star
3

fleetdb

A schema-free database implemented in Clojure
Clojure
170
star
4

clj-json

Fast JSON encoding and decoding for Clojure via the Jackson library
Clojure
90
star
5

clj-redis

Clojure Redis client library
Clojure
79
star
6

pgpin

Example of a database-backed service in Go
Go
62
star
7

zk

Zookeeper CLI designed to be fast, easy to install, and Unix-friendly
Go
59
star
8

clj-garden

Where I grow Clojure codes
Clojure
56
star
9

clj-html

Fast HTML templates in Clojure
Clojure
45
star
10

textmate-clojure

TextMate bundle providing syntax highlighting for Clojure
30
star
11

gitcred

PageRank applied to the GitHub users/follows graph
Clojure
29
star
12

ring-json-params

Ring middleware for parsing JSON into params
Clojure
29
star
13

adder

Sample Clojure web application.
Clojure
25
star
14

weld

A Clojure web framework built on Ring: expressive and fast in a functional style
Clojure
23
star
15

gorg

Persistence for Doozer
Ruby
22
star
16

cabinet

Sample Clojure web application with REST API
Clojure
22
star
17

clj-doc

HTML documentation for Clojure libraries.
JavaScript
21
star
18

petrify

High-durability persistence for log-structured datastores
Ruby
18
star
19

zookeeper-and-go

Example code and Vagrant configurations for getting started with Zookeeper and Go
Go
17
star
20

clj-riak

Clojure bindings to the Riak Protocol Buffers API.
Clojure
16
star
21

fleetdb-client

Clojure client for FleetDB
Clojure
15
star
22

golit

literate-programming-style documentation for Go source
Go
14
star
23

hammockdb

Clojure+Ring CouchDB API implementation
Clojure
13
star
24

clj-serializer

Fast binary serialization and deserialization for Clojure data structures
Java
10
star
25

cljs-demo

Sample programs demonstrating ClojureScript targeted at Node.js
Clojure
10
star
26

clj-unit

Clojure unit testing library: non-magical and developer friendly
Clojure
9
star
27

pg2librato

Periodically query a Postgres DB and emit resuling metrics to Librato
Go
9
star
28

clj-routing

Fast, 2-way, generic URL routing library for use by Clojure web frameworks
Clojure
8
star
29

db-compare

Benchmarking open-source databases
Clojure
6
star
30

spine

Beanstalkd-backed job queueing for Clojure
Clojure
6
star
31

ring-httpcore-adapter

Ring adapter for the Apache HttpCore webserver
Clojure
5
star
32

clj-html-helpers

Helpers for the clj-html Clojure HTML library.
Clojure
5
star
33

fleet-rb

Ruby client for FleetDB
Ruby
4
star
34

heroku-redisgreen

Heroku client plugin for RedisGreen
Ruby
3
star
35

twine

Beanstalkd Clojure client
Clojure
1
star
36

thompson

JVM library for computational algebra in Thompson's group F
Java
1
star
37

tidytrello

Find stale boards in your Trello org
Go
1
star
38

doozer-ops

Ops evaluation notes for Doozer
Shell
1
star