| Welcome! |
| Learn how to use this tour: including how to navigate the different lessons and how to run code. |
| |
| The Go Authors |
| https://golang.org |
| |
| * Hello, 世界 |
| |
| Welcome to a tour of the [[https://golang.org/][Go programming language]]. |
| |
| The tour is divided into a list of modules that you can |
| access by clicking on |
| [[javascript:highlight(".logo")][A Tour of Go]] on the top left of the page. |
| |
| You can also view the table of contents at any time by clicking on the [[javascript:highlightAndClick(".nav")][menu]] on the top right of the page. |
| |
| Throughout the tour you will find a series of slides and exercises for you |
| to complete. |
| |
| You can navigate through them using |
| |
| - [[javascript:highlight(".prev-page")]["previous"]] or `PageUp` to go to the previous page, |
| |
| - [[javascript:highlight(".next-page")]["next"]] or `PageDown` to go to the next page. |
| |
| The tour is interactive. Click the |
| [[javascript:highlightAndClick("#run")][Run]] button now |
| (or press `Shift` + `Enter`) to compile and run the program on |
| #appengine: a remote server. |
| your computer. |
| The result is displayed below the code. |
| |
| These example programs demonstrate different aspects of Go. The programs in the tour are meant to be starting points for your own experimentation. |
| |
| Edit the program and run it again. |
| |
| When you click on [[javascript:highlightAndClick("#format")][Format]] |
| (shortcut: `Ctrl` + `Enter`), the text in the editor is formatted using the |
| [[https://golang.org/cmd/gofmt/][gofmt]] tool. You can switch syntax highlighting on and off |
| by clicking on the [[javascript:highlightAndClick(".syntax-checkbox")][syntax]] button. |
| |
| When you're ready to move on, click the [[javascript:highlightAndClick(".next-page")][right arrow]] below or type the `PageDown` key. |
| |
| .play welcome/hello.go |
| |
| * Go local |
| |
| The tour is available in other languages: |
| |
| - [[https://go-tour-br.appspot.com/][Brazilian Portuguese — Português do Brasil]] |
| - [[https://go-tour-ca.appspot.com/][Catalan — Català]] |
| - [[https://tour.go-zh.org/][Simplified Chinese — 中文(简体)]] |
| - [[https://go-tour-zh-tw.appspot.com/][Traditional Chinese — 中文(繁體)]] |
| - [[https://go-tour-cz.appspot.com/][Czech — Česky]] |
| - [[https://go-tour-fr.appspot.com/][French — Français]] |
| - [[https://go-tour-de.appspot.com/][German — Deutsch]] |
| - [[https://go-tour-he.appspot.com/][Hebrew — עִבְרִית]] |
| - [[https://go-tour-id2.appspot.com/][Indonesian — Bahasa Indonesia]] |
| - [[https://go-tour-ita.appspot.com/][Italian — Italiano]] |
| - [[https://go-tour-jp.appspot.com/][Japanese — 日本語]] |
| - [[https://go-tour-kr.appspot.com/][Korean — 한국어]] |
| - [[https://go-tour-ro.appspot.com/][Romanian — Română]] |
| - [[https://go-tour-ru-ru.appspot.com/][Russian - Русский]] |
| - [[https://go-tour-es.appspot.com/][Spanish — Español]] |
| - [[https://go-tour-th.appspot.com/][Thai - ภาษาไทย]] |
| - [[https://go-tour-turkish.appspot.com/][Turkish - Türkçe]] |
| - [[https://go-tour-ua.appspot.com/][Ukrainian — Українська]] |
| - [[https://go-tour-uz.appspot.com/][Uzbek — Ўзбекча]] |
| |
| Click the [[javascript:highlightAndClick(".next-page")]["next"]] button or type `PageDown` to continue. |
| |
| #appengine: * Go offline |
| #appengine: |
| #appengine: This tour is also available as a stand-alone program that you can use |
| #appengine: without access to the internet. |
| #appengine: |
| #appengine: The stand-alone tour is faster, as it builds and runs the code samples |
| #appengine: on your own machine. |
| #appengine: |
| #appengine: To run the tour locally first |
| #appengine: [[https://golang.org/dl/][download and install Go]] |
| #appengine: then start the tour from the command line: |
| #appengine: |
| #appengine: go tool tour |
| #appengine: |
| #appengine: Or, you can install and run this tour manually if you have any trouble |
| #appengine: running the above command: |
| #appengine: |
| #appengine: go get golang.org/x/tour/gotour |
| #appengine: gotour |
| #appengine: |
| #appengine: The tour program will open a web browser displaying |
| #appengine: your local version of the tour. |
| #appengine: |
| #appengine: Or, of course, you can continue to take the tour through this web site. |
| |
| #appengine: * The Go Playground |
| #appengine: |
| #appengine: This tour is built atop the [[https://play.golang.org/][Go Playground]], a |
| #appengine: web service that runs on [[https://golang.org/][golang.org]]'s servers. |
| #appengine: |
| #appengine: The service receives a Go program, compiles, links, and runs the program inside |
| #appengine: a sandbox, then returns the output. |
| #appengine: |
| #appengine: There are limitations to the programs that can be run in the playground: |
| #appengine: |
| #appengine: - In the playground the time begins at 2009-11-10 23:00:00 UTC (determining the significance of this date is an exercise for the reader). This makes it easier to cache programs by giving them deterministic output. |
| #appengine: |
| #appengine: - There are also limits on execution time and on CPU and memory usage, and the program cannot access external network hosts. |
| #appengine: |
| #appengine: The playground uses the latest stable release of Go. |
| #appengine: |
| #appengine: Read "[[https://blog.golang.org/playground][Inside the Go Playground]]" to learn more. |
| #appengine: |
| #appengine: .play welcome/sandbox.go |
| |
| * Congratulations |
| |
| You've finished the first module of the tour! |
| |
| Now click on [[javascript:highlightAndClick(".logo")][A Tour of Go]] to find out what else |
| you can learn about Go, or go directly to the [[javascript:click('.next-page')][next lesson]]. |