blob: 21a9a63d51c01d57949d0511c0fbf440f57b5934 [file] [log] [blame]
Andrew Gerrand7cb21a72012-01-19 11:24:54 +11001<!--{
Andrew Gerrand8bbe5cc2012-01-20 07:37:36 +11002 "Title": "Documentation",
Andrew Bonventre98603e72017-08-29 16:23:49 -04003 "Path": "/doc/",
4 "Template": true
Andrew Gerrand7cb21a72012-01-19 11:24:54 +11005}-->
Andrew Gerrand1ca99c82010-05-27 16:47:42 -07006
Andrew Gerrandd84de092012-02-13 21:22:36 +11007<p>
8The Go programming language is an open source project to make programmers more
9productive.
10</p>
11
12<p>
13Go is expressive, concise, clean, and efficient. Its concurrency
14mechanisms make it easy to write programs that get the most out of multicore
15and networked machines, while its novel type system enables flexible and
16modular program construction. Go compiles quickly to machine code yet has the
17convenience of garbage collection and the power of run-time reflection. It's a
18fast, statically typed, compiled language that feels like a dynamically typed,
19interpreted language.
20</p>
21
22<div id="manual-nav"></div>
Andrew Gerrand6ab8d242010-09-16 14:01:02 +100023
Andrew Gerrandf78d50c2012-03-05 14:31:27 +110024<h2>Installing Go</h2>
25
26<h3><a href="/doc/install">Getting Started</a></h3>
27<p>
28Instructions for downloading and installing the Go compilers, tools, and
29libraries.
30</p>
31
32
Andrew Gerrand6ab8d242010-09-16 14:01:02 +100033<h2 id="learning">Learning Go</h2>
34
Andrew Gerrandf200b722012-03-06 12:50:52 +110035<img class="gopher" src="/doc/gopher/doc.png"/>
36
Andrew Bonventre98603e72017-08-29 16:23:49 -040037<h3 id="go_tour">
38 {{if $.GoogleCN}}
39 A Tour of Go
40 {{else}}
41 <a href="//tour.golang.org/">A Tour of Go</a>
42 {{end}}
43</h3>
Andrew Gerrandf03b37b2011-10-05 11:12:07 -070044<p>
45An interactive introduction to Go in three sections.
46The first section covers basic syntax and data structures; the second discusses
47methods and interfaces; and the third introduces Go's concurrency primitives.
48Each section concludes with a few exercises so you can practice what you've
Andrew Bonventre98603e72017-08-29 16:23:49 -040049learned. You can {{if not $.GoogleCN}}<a href="//tour.golang.org/">take the tour
50online</a> or{{end}} install it locally with:
Edward Muller69e7e8a2016-08-30 19:14:46 -070051</p>
Edward Muller69e7e8a2016-08-30 19:14:46 -070052<pre>
53$ go get golang.org/x/tour/gotour
54</pre>
Ryuji Iwatac52e26e2017-11-25 18:09:54 +090055<p>
Edward Muller69e7e8a2016-08-30 19:14:46 -070056This will place the <code>gotour</code> binary in your workspace's <code>bin</code> directory.
Andrew Gerrandf03b37b2011-10-05 11:12:07 -070057</p>
58
Andrew Gerrandf78d50c2012-03-05 14:31:27 +110059<h3 id="code"><a href="code.html">How to write Go code</a></h3>
60<p>
Andrew Bonventre98603e72017-08-29 16:23:49 -040061{{if not $.GoogleCN}}
62Also available as a <a href="//www.youtube.com/watch?v=XCsL89YtqCs">screencast</a>, this
63{{else}}
64This
65{{end}}
66doc explains how to use the <a href="/cmd/go/">go command</a>
67to fetch, build, and install packages, commands, and run tests.
Andrew Gerrandf78d50c2012-03-05 14:31:27 +110068</p>
69
Jaana Burcu Dogan77ee8612017-06-14 12:41:14 -070070<h3 id="editors"><a href="editors.html">Editor plugins and IDEs</a></h3>
71<p>
72A document that summarizes commonly used editor plugins and IDEs with
73Go support.
74</p>
75
Andrew Gerrand1ca99c82010-05-27 16:47:42 -070076<h3 id="effective_go"><a href="effective_go.html">Effective Go</a></h3>
77<p>
78A document that gives tips for writing clear, idiomatic Go code.
Rob Pike7201b0c2012-02-28 13:35:58 +110079A must read for any new Go programmer. It augments the tour and
Peter Mundyabb0c092010-11-29 10:10:02 +090080the language specification, both of which should be read first.
Andrew Gerrand1ca99c82010-05-27 16:47:42 -070081</p>
82
Jaana Burcu Dogan669dcca2017-09-05 13:15:56 -070083<h3 id="diagnostics"><a href="/doc/diagnostics.html">Diagnostics</a></h3>
84<p>
85Summarizes tools and methodologies to diagnose problems in Go programs.
86</p>
87
Andrew Gerrand5dd74172013-09-16 15:47:13 +100088<h3 id="faq"><a href="/doc/faq">Frequently Asked Questions (FAQ)</a></h3>
Andrew Gerrand1ca99c82010-05-27 16:47:42 -070089<p>
Andrew Gerrandd84de092012-02-13 21:22:36 +110090Answers to common questions about Go.
Andrew Gerrand1ca99c82010-05-27 16:47:42 -070091</p>
92
Andrew Gerrand5dd74172013-09-16 15:47:13 +100093<h3 id="wiki"><a href="/wiki">The Go Wiki</a></h3>
Andrew Gerrand539178b2012-03-05 15:07:43 +110094<p>A wiki maintained by the Go community.</p>
Andrew Gerrandd84de092012-02-13 21:22:36 +110095
Andrew Gerrand5dd74172013-09-16 15:47:13 +100096<h4 id="learn_more">More</h4>
Andrew Gerrandc9836be2012-03-08 16:10:55 +110097<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100098See the <a href="/wiki/Learn">Learn</a> page at the <a href="/wiki">Wiki</a>
99for more Go learning resources.
Andrew Gerrandc9836be2012-03-08 16:10:55 +1100100</p>
101
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000102
103<h2 id="references">References</h2>
104
105<h3 id="pkg"><a href="/pkg/">Package Documentation</a></h3>
Andrew Gerrand3bd07692013-05-01 10:00:05 -0400106<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000107The documentation for the Go standard library.
Andrew Gerrand3bd07692013-05-01 10:00:05 -0400108</p>
109
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000110<h3 id="cmd"><a href="/doc/cmd">Command Documentation</a></h3>
Rob Pikea97a7c52013-09-12 09:08:59 +1000111<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000112The documentation for the Go tools.
Rob Pikea97a7c52013-09-12 09:08:59 +1000113</p>
114
Andrew Gerrand48ba6fe2013-10-04 09:45:06 +1000115<h3 id="spec"><a href="/ref/spec">Language Specification</a></h3>
Andrew Gerrandc9836be2012-03-08 16:10:55 +1100116<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000117The official Go Language specification.
Andrew Gerrandc9836be2012-03-08 16:10:55 +1100118</p>
119
Andrew Gerrand48ba6fe2013-10-04 09:45:06 +1000120<h3 id="go_mem"><a href="/ref/mem">The Go Memory Model</a></h3>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000121<p>
122A document that specifies the conditions under which reads of a variable in
123one goroutine can be guaranteed to observe values produced by writes to the
124same variable in a different goroutine.
125</p>
126
Andrew Gerrandd131ffe2014-06-12 13:31:13 +1000127<h3 id="release"><a href="/doc/devel/release.html">Release History</a></h3>
128<p>A summary of the changes between Go releases.</p>
129
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000130
131<h2 id="articles">Articles</h2>
Andrew Gerrandd84de092012-02-13 21:22:36 +1100132
Andrew Bonventre98603e72017-08-29 16:23:49 -0400133{{if not $.GoogleCN}}
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000134<h3 id="blog"><a href="//blog.golang.org/">The Go Blog</a></h3>
Andrew Gerrandf78d50c2012-03-05 14:31:27 +1100135<p>The official blog of the Go project, featuring news and in-depth articles by
136the Go team and guests.</p>
Andrew Bonventre98603e72017-08-29 16:23:49 -0400137{{end}}
Andrew Gerrandf78d50c2012-03-05 14:31:27 +1100138
Andrew Gerrande8636a62012-03-13 11:00:11 +1100139<h4>Codewalks</h4>
Yves Junqueirade3a3972010-11-23 10:43:16 +1100140<p>
Francisco Souzaa786fe82012-03-27 13:35:40 +1100141Guided tours of Go programs.
Yves Junqueirade3a3972010-11-23 10:43:16 +1100142</p>
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000143<ul>
144<li><a href="/doc/codewalk/functions">First-Class Functions in Go</a></li>
145<li><a href="/doc/codewalk/markov">Generating arbitrary text: a Markov chain algorithm</a></li>
146<li><a href="/doc/codewalk/sharemem">Share Memory by Communicating</a></li>
Andrew Gerrandf78d50c2012-03-05 14:31:27 +1100147<li><a href="/doc/articles/wiki/">Writing Web Applications</a> - building a simple web application.</li>
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000148</ul>
Yves Junqueirade3a3972010-11-23 10:43:16 +1100149
Andrew Bonventre98603e72017-08-29 16:23:49 -0400150{{if not $.GoogleCN}}
Andrew Gerrande8636a62012-03-13 11:00:11 +1100151<h4>Language</h4>
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000152<ul>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000153<li><a href="/blog/json-rpc-tale-of-interfaces">JSON-RPC: a tale of interfaces</a></li>
154<li><a href="/blog/gos-declaration-syntax">Go's Declaration Syntax</a></li>
155<li><a href="/blog/defer-panic-and-recover">Defer, Panic, and Recover</a></li>
156<li><a href="/blog/go-concurrency-patterns-timing-out-and">Go Concurrency Patterns: Timing out, moving on</a></li>
157<li><a href="/blog/go-slices-usage-and-internals">Go Slices: usage and internals</a></li>
158<li><a href="/blog/gif-decoder-exercise-in-go-interfaces">A GIF decoder: an exercise in Go interfaces</a></li>
159<li><a href="/blog/error-handling-and-go">Error Handling and Go</a></li>
160<li><a href="/blog/organizing-go-code">Organizing Go code</a></li>
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000161</ul>
162
Andrew Gerrande8636a62012-03-13 11:00:11 +1100163<h4>Packages</h4>
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000164<ul>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000165<li><a href="/blog/json-and-go">JSON and Go</a> - using the <a href="/pkg/encoding/json/">json</a> package.</li>
166<li><a href="/blog/gobs-of-data">Gobs of data</a> - the design and use of the <a href="/pkg/encoding/gob/">gob</a> package.</li>
167<li><a href="/blog/laws-of-reflection">The Laws of Reflection</a> - the fundamentals of the <a href="/pkg/reflect/">reflect</a> package.</li>
168<li><a href="/blog/go-image-package">The Go image package</a> - the fundamentals of the <a href="/pkg/image/">image</a> package.</li>
169<li><a href="/blog/go-imagedraw-package">The Go image/draw package</a> - the fundamentals of the <a href="/pkg/image/draw/">image/draw</a> package.</li>
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000170</ul>
Andrew Bonventre98603e72017-08-29 16:23:49 -0400171{{end}}
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000172
Andrew Gerrande8636a62012-03-13 11:00:11 +1100173<h4>Tools</h4>
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000174<ul>
Andrew Gerrand73b8ccb2012-03-07 07:40:21 +1100175<li><a href="/doc/articles/go_command.html">About the Go command</a> - why we wrote it, what it is, what it's not, and how to use it.</li>
Andrew Gerrand98155bd2012-03-27 11:42:01 +1100176<li><a href="/doc/gdb">Debugging Go Code with GDB</a></li>
Andrew Bonventre98603e72017-08-29 16:23:49 -0400177<li><a href="/doc/articles/race_detector.html">Data Race Detector</a> - a manual for the data race detector.</li>
178<li><a href="/doc/asm">A Quick Guide to Go's Assembler</a> - an introduction to the assembler used by Go.</li>
179{{if not $.GoogleCN}}
180<li><a href="/blog/c-go-cgo">C? Go? Cgo!</a> - linking against C code with <a href="/cmd/cgo/">cgo</a>.</li>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000181<li><a href="/blog/godoc-documenting-go-code">Godoc: documenting Go code</a> - writing good documentation for <a href="/cmd/godoc/">godoc</a>.</li>
182<li><a href="/blog/profiling-go-programs">Profiling Go Programs</a></li>
Robin Eklind8e902dd2014-07-09 14:26:37 -0700183<li><a href="/blog/race-detector">Introducing the Go Race Detector</a> - an introduction to the race detector.</li>
Andrew Bonventre98603e72017-08-29 16:23:49 -0400184{{end}}
Andrew Gerrand3bc2d0f2011-09-10 09:35:25 +1000185</ul>
186
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000187<h4 id="articles_more">More</h4>
188<p>
189See the <a href="/wiki/Articles">Articles page</a> at the
190<a href="/wiki">Wiki</a> for more Go articles.
191</p>
192
Andrew Bonventre98603e72017-08-29 16:23:49 -0400193{{if not $.GoogleCN}}
Andrew Gerrandf78d50c2012-03-05 14:31:27 +1100194<h2 id="talks">Talks</h2>
Andrew Gerrandbab711b2010-07-30 10:36:13 +1000195
Andrew Gerrandf200b722012-03-06 12:50:52 +1100196<img class="gopher" src="/doc/gopher/talks.png"/>
197
Andrew Gerrand0bc952c2012-08-09 08:50:13 +1000198<h3 id="video_tour_of_go"><a href="http://research.swtch.com/gotour">A Video Tour of Go</a></h3>
199<p>
200Three things that make Go fast, fun, and productive:
201interfaces, reflection, and concurrency. Builds a toy web crawler to
202demonstrate these.
203</p>
204
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000205<h3 id="go_code_that_grows"><a href="//vimeo.com/53221560">Code that grows with grace</a></h3>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000206<p>
207One of Go's key design goals is code adaptability; that it should be easy to take a simple design and build upon it in a clean and natural way. In this talk Andrew Gerrand describes a simple "chat roulette" server that matches pairs of incoming TCP connections, and then use Go's concurrency mechanisms, interfaces, and standard library to extend it with a web interface and other features. While the function of the program changes dramatically, Go's flexibility preserves the original design as it grows.
208</p>
209
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000210<h3 id="go_concurrency_patterns"><a href="//www.youtube.com/watch?v=f6kdp27TYZs">Go Concurrency Patterns</a></h3>
Andrew Gerrand4087c1b2012-07-22 16:35:53 -0700211<p>
212Concurrency is the key to designing high performance network services. Go's concurrency primitives (goroutines and channels) provide a simple and efficient means of expressing concurrent execution. In this talk we see how tricky concurrency problems can be solved gracefully with simple Go code.
213</p>
214
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000215<h3 id="advanced_go_concurrency_patterns"><a href="//www.youtube.com/watch?v=QDDwwePbDtw">Advanced Go Concurrency Patterns</a></h3>
Andrew Gerrand4087c1b2012-07-22 16:35:53 -0700216<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000217This talk expands on the <i>Go Concurrency Patterns</i> talk to dive deeper into Go's concurrency primitives.
Andrew Gerrandbab711b2010-07-30 10:36:13 +1000218</p>
Andrew Gerrand1ca99c82010-05-27 16:47:42 -0700219
Andrew Gerrande8636a62012-03-13 11:00:11 +1100220<h4 id="talks_more">More</h4>
Andrew Gerrand1ca99c82010-05-27 16:47:42 -0700221<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000222See the <a href="/talks">Go Talks site</a> and <a href="/wiki/GoTalks">wiki page</a> for more Go talks.
Andrew Gerrand1ca99c82010-05-27 16:47:42 -0700223</p>
Andrew Bonventre98603e72017-08-29 16:23:49 -0400224{{end}}
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000225
Andrew Gerrandf78d50c2012-03-05 14:31:27 +1100226<h2 id="nonenglish">Non-English Documentation</h2>
227
Andrew Gerrand1748dc32010-10-14 17:25:23 +1100228<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000229See the <a href="/wiki/NonEnglish">NonEnglish</a> page
230at the <a href="/wiki">Wiki</a> for localized
Andrew Gerrandf78d50c2012-03-05 14:31:27 +1100231documentation.
Andrew Gerrand1748dc32010-10-14 17:25:23 +1100232</p>