2012-01-19 11:24:54 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								<!-- {
 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-13 21:22:36 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									"Title": "Getting Started",
							 
						 
					
						
							
								
									
										
										
										
											2012-03-05 14:31:27 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									"Path":  "/doc/install"
							 
						 
					
						
							
								
									
										
										
										
											2012-01-19 11:24:54 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}-->
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-03 15:59:17 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h2  id = "download" > Download the Go distribution< / h2 > 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-13 16:34:52 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< a  href = "/dl/"  id = "start"  class = "download"  target = "_blank" > 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-03 15:59:17 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< span  class = "big" > Download Go< / span > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< span  class = "desc" > Click here to visit the downloads page< / span > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / a > 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-08 22:12:51 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-05 14:31:26 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< a  href = "https://code.google.com/p/go/wiki/Downloads?tm=2"  target = "_blank" > Official binary
							 
						 
					
						
							
								
									
										
										
										
											2014-04-15 16:40:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								distributions< / a >  are available for the FreeBSD (release 8 and above), Linux, Mac OS X (Snow Leopard
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								and above), and Windows operating systems and the 32-bit (< code > 386< / code > ) and
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								64-bit (< code > amd64< / code > ) x86 processor architectures.
							 
						 
					
						
							
								
									
										
										
										
											2013-04-03 15:59:17 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								If a binary distribution is not available for your combination of operating
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								system and architecture, try
							 
						 
					
						
							
								
									
										
										
										
											2013-04-03 15:59:17 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< a  href = "/doc/install/source" > installing from source< / a >  or
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< a  href = "/doc/install/gccgo" > installing gccgo instead of gc< / a > .
							 
						 
					
						
							
								
									
										
										
										
											2009-11-05 15:07:42 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-16 14:54:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h2  id = "requirements" > System requirements< / h2 > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-16 14:54:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								The < code > gc< / code >  compiler supports the following operating systems and
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								architectures. Please ensure your system meets these requirements before
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								proceeding. If your OS or architecture is not on the list, it's possible that
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< code > gccgo< / code >  might support your setup; see
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< a  href = "/doc/install/gccgo" > Setting up and using gccgo< / a >  for details.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< table  class = "codetable"  frame = "border"  summary = "requirements" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-10 11:19:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< th  align = "center" > Operating system< / th > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< th  align = "center" > Architectures< / th > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< th  align = "center" > Notes< / th > 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-16 14:54:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< tr > < td  colspan = "3" > < hr > < / td > < / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-08 01:25:28 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< tr > < td > FreeBSD 8 or later< / td >  < td > amd64, 386, arm< / td >  < td > Debian GNU/kFreeBSD not supported; FreeBSD/ARM needs FreeBSD 10 or later< / td > < / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-07 11:12:54 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< tr > < td > Linux 2.6.23 or later with glibc< / td >  < td > amd64, 386, arm< / td >  < td > CentOS/RHEL 5.x not supported; no binary distribution for ARM yet< / td > < / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 11:53:01 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< tr > < td > Mac OS X 10.6 or later< / td >  < td > amd64, 386< / td >  < td > use the gcc< sup > † < / sup >  that comes with Xcode< sup > ‡ < / sup > < / td > < / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-08 01:25:28 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< tr > < td > Windows XP or later< / td >  < td > amd64, 386< / td >  < td > use MinGW gcc< sup > † < / sup > . No need for cgywin or msys.< / td > < / tr > 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-16 14:54:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / table > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-20 21:21:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< sup > † < / sup > < code > gcc< / code >  is required only if you plan to use
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< a  href = "/cmd/cgo" > cgo< / a > .< br / > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< sup > ‡ < / sup > You only need to install the command line tools for
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< a  href = "http://developer.apple.com/Xcode/" > Xcode< / a > . If you have already
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								installed Xcode 4.3+, you can install it from the Components tab of the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Downloads preferences panel.
							 
						 
					
						
							
								
									
										
										
										
											2012-05-16 14:54:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-13 15:02:14 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h2  id = "install" > Install the Go tools< / h2 > 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-27 14:16:56 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-17 17:01:09 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								If you are upgrading from an older version of Go you must
							 
						 
					
						
							
								
									
										
										
										
											2013-09-16 11:20:07 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								first < a  href = "#uninstall" > remove the existing version< / a > .
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< h3  id = "tarball" > Linux, Mac OS X, and FreeBSD tarballs< / h3 > 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-27 14:16:56 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-05 14:31:26 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< a  href = "https://code.google.com/p/go/wiki/Downloads?tm=2" > Download the archive< / a > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								and extract it into < code > /usr/local< / code > , creating a Go tree in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< code > /usr/local/go< / code > . For example:
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< pre > 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-06 16:09:01 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / pre > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-27 15:34:18 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-06 16:09:01 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Choose the archive file appropriate for your installation.
							 
						 
					
						
							
								
									
										
										
										
											2014-03-03 11:26:18 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								the archive you want is called < code > go1.2.1.linux-amd64.tar.gz< / code > .
							 
						 
					
						
							
								
									
										
										
										
											2012-09-27 15:34:18 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 13:59:30 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								(Typically these commands must be run as root or through < code > sudo< / code > .)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-27 14:16:56 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Add < code > /usr/local/go/bin< / code >  to the < code > PATH< / code >  environment
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								variable. You can do this by adding this line to your < code > /etc/profile< / code > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								(for a system-wide installation) or < code > $HOME/.profile< / code > :
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< pre > 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								export PATH=$PATH:/usr/local/go/bin
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / pre > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-25 13:36:16 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h4  id = "tarball_non_standard" > Installing to a custom location< / h4 > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								The Go binary distributions assume they will be installed in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< code > /usr/local/go< / code >  (or < code > c:\Go< / code >  under Windows),
							 
						 
					
						
							
								
									
										
										
										
											2013-11-25 13:36:16 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								but it is possible to install the Go tools to a different location.
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								In this case you must set the < code > GOROOT< / code >  environment variable
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								to point to the directory in which it was installed.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								For example, if you installed Go to your home directory you should add the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								following commands to < code > $HOME/.profile< / code > :
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< pre > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								export GOROOT=$HOME/go
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								export PATH=$PATH:$GOROOT/bin
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / pre > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< b > Note< / b > : < code > GOROOT< / code >  must be set only when installing to a custom
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								location.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-17 17:01:09 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h3  id = "osx" > Mac OS X package installer< / h3 > 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-05 14:31:26 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< a  href = "https://code.google.com/p/go/wiki/Downloads?tm=2" > Download the package file< / a > ,
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								open it, and follow the prompts to install the Go tools.
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								The package installs the Go distribution to < code > /usr/local/go< / code > .
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								The package should put the < code > /usr/local/go/bin< / code >  directory in your
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< code > PATH< / code >  environment variable. You may need to restart any open
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Terminal sessions for the change to take effect.
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h3  id = "windows" > Windows< / h3 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-13 15:02:14 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								The Go project provides two installation options for Windows users
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								(besides < a  href = "/doc/install/source" > installing from source< / a > ):
							 
						 
					
						
							
								
									
										
										
										
											2012-03-27 11:19:30 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								a zip archive that requires you to set some environment variables and an
							 
						 
					
						
							
								
									
										
										
										
											2013-09-16 11:20:07 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								MSI installer that configures your installation automatically.
							 
						 
					
						
							
								
									
										
										
										
											2012-03-13 15:02:14 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h4  id = "windows_msi" > MSI installer< / h4 > 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-13 15:02:14 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-05 14:31:26 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Open the < a  href = "https://code.google.com/p/go/wiki/Downloads?tm=2" > MSI file< / a > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								and follow the prompts to install the Go tools.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								By default, the installer puts the Go distribution in < code > c:\Go< / code > .
							 
						 
					
						
							
								
									
										
										
										
											2012-03-06 15:16:02 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								The installer should put the < code > c:\Go\bin< / code >  directory in your
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< code > PATH< / code >  environment variable. You may need to restart any open
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								command prompts for the change to take effect.
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h4  id = "windows_zip" > Zip archive< / h4 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-13 15:02:14 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-05 14:31:26 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< a  href = "https://code.google.com/p/go/wiki/Downloads?tm=2" > Download the zip file< / a >  and extract it into the directory of your choice (we suggest < code > c:\Go< / code > ).
							 
						 
					
						
							
								
									
										
										
										
											2012-03-13 15:02:14 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								If you chose a directory other than < code > c:\Go< / code > ,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								you must set the < code > GOROOT< / code >  environment variable to your chosen path.
							 
						 
					
						
							
								
									
										
										
										
											2012-03-13 15:02:14 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Add the < code > bin< / code >  subdirectory of your Go root (for example, < code > c:\Go\bin< / code > ) to your < code > PATH< / code >  environment variable.
							 
						 
					
						
							
								
									
										
										
										
											2012-03-13 15:02:14 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< h4  id = "windows_env" > Setting environment variables under Windows< / h4 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Under Windows, you may set environment variables through the "Environment
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Variables" button on the "Advanced" tab of the "System" control panel. Some
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								versions of Windows provide this control panel through the "Advanced System
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Settings" option inside the "System" control panel.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 13:59:30 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h2  id = "testing" > Test your installation< / h2 > 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Check that Go is installed correctly by building a simple program, as follows.
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Create a file named < code > hello.go< / code >  and put the following program in it:
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< pre > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								package main
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								import "fmt"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								func main() {
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    fmt.Printf("hello, world\n")
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / pre > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Then run it with the < code > go< / code >  tool:
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< pre > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$ go run hello.go
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								hello, world
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / pre > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 17:02:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								If you see the "hello, world" message then your Go installation is working.
							 
						 
					
						
							
								
									
										
										
										
											2009-10-23 15:24:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-16 14:01:02 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h2  id = "gopath" > Set up your work environment< / h2 > 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-08 23:38:30 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								You're almost done.
							 
						 
					
						
							
								
									
										
										
										
											2014-09-09 07:35:44 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								You just need to set up your environment.
							 
						 
					
						
							
								
									
										
										
										
											2009-11-08 23:38:30 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-09 07:35:44 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Read the < a  href = "/doc/code.html" > How to Write Go Code< / a >  document,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								which provides < b > essential setup instructions< / b >  for using the Go tools.
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 20:00:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-16 11:20:07 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< h2  id = "uninstall" > Uninstalling Go< / h2 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								To remove an existing Go installation from your system delete the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< code > go< / code >  directory. This is usually < code > /usr/local/go< / code > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								under Linux, Mac OS X, and FreeBSD or < code > c:\Go< / code > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								under Windows.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								You should also remove the Go < code > bin< / code >  directory from your
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< code > PATH< / code >  environment variable.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Under Linux and FreeBSD you should edit < code > /etc/profile< / code >  or
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< code > $HOME/.profile< / code > .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								If you installed Go with the < a  href = "#osx" > Mac OS X package< / a >  then you
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								should remove the < code > /etc/paths.d/go< / code >  file.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Windows users should read the section about < a  href = "#windows_env" > setting
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								environment variables under Windows< / a > .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< h2  id = "help" > Getting help< / h2 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								For real-time help, ask the helpful gophers in < code > #go-nuts< / code >  on the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< a  href = "http://freenode.net/" > Freenode< / a >  IRC server.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								The official mailing list for discussion of the Go language is
							 
						 
					
						
							
								
									
										
										
										
											2014-07-25 10:28:39 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< a  href = "//groups.google.com/group/golang-nuts" > Go Nuts< / a > .
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Report bugs using the
							 
						 
					
						
							
								
									
										
										
										
											2014-07-25 10:28:39 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< a  href = "//golang.org/issue" > Go issue tracker< / a > .
							 
						 
					
						
							
								
									
										
										
										
											2013-11-21 07:55:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< / p >