Jump into Go's Source
People ask all the time "How does this work in Go?" or "How is that implemented in Go?". If you have a similar question, maybe it is time you look at the source code. Understandably, this is not people's first instinct. However, Go's source code is very approachable, in part due to the simplicity of the language.
Installing Go from source is
simple and tends to be the preferred installation method for many Go
users. If using the official binary distribution, the source to the
standard library is available at $(go env GOROOT)/src/pkg
. Or, you can
browse the source tree at http://golang.org/src.
So, why not get started? Here is a selection of great literature on Go's internals, as well as a simplified and annotated tree of Go's source with an emphasis on the runtime:
- Design Documents on go-wiki
- Go Data Structures: Interfaces (2009) by Russ Cox
- The Go scheduler, and The Go netpoller (2013) by Daniel Morsing
./src ├── cmd │ ├── cgo: cgo preprocessor │ ├── gc: Go compiler │ ├── go: main CLI for Go users │ └── ...rest of toolchain └── pkg ├── go: tooling of Go code ├── runtime │ ├── runtime.h: data structures, scheduler states │ ├── proc.c: scheduler │ ├── mgc0.c: garbage collector │ ├── chan.c: channels │ ├── slice.c: slices │ ├── hashmap.c: maps │ ├── cgocall.c: cgo │ └── ...rest of runtime └── ...rest of standard library
For the Go tools, such as godoc, vet, and cover, you can simply find
their sources in your $GOPATH
after installing, or visit
go.tools on Google Code. If you
want to keep up with development, the
golang-dev and
golang-nuts mailing lists
are worth following, as well as the Go development
dashboard.
Whew. If you got that far, consider contributing!