blob: 9fdd85f46f0c4a5ad24122352f3db4df059167ea [file] [log] [blame] [view]
jimmyfrasched3f12812017-10-05 15:36:01 -07001# Go project directory layout
jimmyfrasched3f12812017-10-05 15:36:01 -07002
jimmyfrasche4b647142017-10-05 16:12:10 -07003The Go project itself contains a number of subdirectories. This document will provide a brief overview, but many of these directories have individual README.md or README files that describe their purpose in detail.
4
5- [api](#api)
6- [bin](#bin)
7- [blog](#blog)
8- [doc](#doc)
9- [lib](#lib)
10- [misc](#misc)
jimmyfrasche1842d8e2017-10-05 16:18:43 -070011 - [android](#miscandroid)
12 - [arm](#miscarm)
13 - [cgo](#misccgo)
14 - [chrome](#miscchrome)
15 - [git](#miscgit)
16 - [ios](#miscios)
17 - [linkcheck](#misclinkcheck)
18 - [nacl](#miscnacl)
19 - [sortac](#miscsortac)
20 - [swig](#miscswig)
21 - [tour](#misctour)
22 - [trace](#misctrace)
jimmyfrasche4b647142017-10-05 16:12:10 -070023- [pkg](#pkg)
jimmyfrasche1842d8e2017-10-05 16:18:43 -070024 - [include](#pkginclude)
25 - [obj](#pkgobj)
26 - [tool](#pkgtool)
jimmyfrasche4b647142017-10-05 16:12:10 -070027- [src](#src)
28- [test](#test)
29
30## api
31
32The `api` directory contains machine checkable specifications for the Go standard library, to help enforce the [Go 1 compatibility promise](https://golang.org/doc/go1compat).
33
34## bin
35
36The `bin` directory contains the binaries of the project: `go`, `godoc`, and `gofmt`.
37
38## blog
39
40The `blog` directory contains the source and templates for [the Go blog](https://blog.golang.org/). However, the code for serving the blog is at https://godoc.org/golang.org/x/blog
41
42## doc
43
44The `doc` directory contains the resources served at https://golang.org/doc/
45
46## lib
47
48The `lib` directory contains a single subdirectory `lib/time` which contains a copy of the time zone database that Go uses if it cannot find the operating systems copy.
49
50## misc
51
jimmyfrasche1842d8e2017-10-05 16:18:43 -070052### misc/android
53
54### misc/arm
55
56### misc/cgo
57
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070058The `misc/cgo` directory contains tests and examples of cgo.
59
jimmyfrasche1842d8e2017-10-05 16:18:43 -070060### misc/chrome
61
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070062The `misc/chrome` directory contains a Chrome extension for Go contributors.
63
jimmyfrasche1842d8e2017-10-05 16:18:43 -070064### misc/git
65
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070066The `misc/git` directory contains a pre-commit hook to ensure that go files have been run through gofmt.
67
jimmyfrasche1842d8e2017-10-05 16:18:43 -070068### misc/ios
69
70### misc/linkcheck
71
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070072The `misc/linkcheck` directory contains a program for ensuring there are no missing links in the godoc website.
73
jimmyfrasche1842d8e2017-10-05 16:18:43 -070074### misc/nacl
75
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070076The `misc/nacl` directory contains Go's integration with nacl, which is used by [the Go playground](https://play.golang.org).
77
jimmyfrasche1842d8e2017-10-05 16:18:43 -070078### misc/sortac
79
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070080The `misc/sortac` directory contains a utility for sorting the `AUTHORS` and `CONTRIBUTORS` files.
81
jimmyfrasche1842d8e2017-10-05 16:18:43 -070082### misc/swig
83
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070084The `misc/swig` directory contains examples of using Go with [SWIG](https://github.com/swig/swig).
85
jimmyfrasche1842d8e2017-10-05 16:18:43 -070086### misc/tour
87
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070088The `misc/tour` directory contains the resources and source code for the [Go tour](https://tour.golang.org).
89
jimmyfrasche1842d8e2017-10-05 16:18:43 -070090### misc/trace
91
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070092The `misc/trace` directory contains a generated file used by `go tool trace`.
93
jimmyfrasche4b647142017-10-05 16:12:10 -070094## pkg
95
jimmyfrascheef5e7ea2017-10-05 16:42:07 -070096The `pkg` directory contains platform-specific build artifacts. It will always contain the following:
97
jimmyfrasche1842d8e2017-10-05 16:18:43 -070098### pkg/include
99
100### pkg/obj
101
102### pkg/tool
103
jimmyfrascheef5e7ea2017-10-05 16:42:07 -0700104The `pkg/tool` directory contains the platform-specific tool chain exposed by the `go tool` command.
105
jimmyfrasche4b647142017-10-05 16:12:10 -0700106## src
107
108The `src` directory contains the source code for the standard library and, in `src/cmd`, tool chain.
109
110## test
111
112The `test` directory contains extensive additional tests for the runtime and tool chain.