github.com/varialus/godfly@v0.0.0-20130904042352-1934f9f095ab/doc/install.html (about)

     1  <!--{
     2  	"Title": "Getting Started",
     3  	"Path":  "/doc/install"
     4  }-->
     5  
     6  <h2 id="download">Download the Go distribution</h2>
     7  
     8  <p>
     9  <a href="http://code.google.com/p/go/downloads" id="start" class="download" target="_blank">
    10  <span class="big">Download Go</span>
    11  <span class="desc">Click here to visit the downloads page</span>
    12  </a>
    13  </p>
    14  
    15  <p>
    16  Click the link above to visit the
    17  <a href="http://code.google.com/p/go/downloads">Go project's downloads page</a>
    18  and select the binary distribution that matches your operating system and
    19  processor architecture.
    20  </p>
    21  
    22  <p>
    23  Official binary distributions are available for the FreeBSD, Linux, Mac OS X
    24  (Snow Leopard, Lion, and Mountain Lion), NetBSD, and Windows operating systems
    25  and the 32-bit (<code>386</code>) and 64-bit (<code>amd64</code>) x86 processor
    26  architectures.
    27  </p>
    28  
    29  <p>
    30  If a binary distribution is not available for your combination of operating
    31  system and architecture you may want to try
    32  <a href="/doc/install/source">installing from source</a> or
    33  <a href="/doc/install/gccgo">installing gccgo instead of gc</a>.
    34  </p>
    35  
    36  <h2 id="requirements">System requirements</h2>
    37  <p>
    38  The <code>gc</code> compiler supports the following operating systems and
    39  architectures. Please ensure your system meets these requirements before
    40  proceeding. If your OS or architecture is not on the list, it's possible that
    41  <code>gccgo</code> might support your setup; see
    42  <a href="/doc/install/gccgo">Setting up and using gccgo</a> for details.
    43  </p>
    44  
    45  <table class="codetable" frame="border" summary="requirements">
    46  <tr>
    47  <th align="middle">Operating system</th>
    48  <th align="middle">Architectures</th>
    49  <th align="middle">Notes</th>
    50  </tr>
    51  <tr><td colspan="3"><hr></td></tr>
    52  <tr><td>FreeBSD 7 or later</td> <td>amd64, 386, arm</td> <td>Debian GNU/kFreeBSD not supported; FreeBSD/ARM needs FreeBSD 10 or later</td></tr>
    53  <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>
    54  <tr><td>Mac OS X 10.6/10.7</td> <td>amd64, 386</td> <td>use the gcc<sup>&#8224;</sup> that comes with Xcode<sup>&#8225;</sup></td></tr>
    55  <tr><td>Windows 2000 or later</td> <td>amd64, 386</td> <td>use mingw gcc<sup>&#8224;</sup>; cygwin or msys is not needed</td></tr>
    56  <tr><td>NetBSD 6 or later</td> <td>amd64, 386</td> <td></td></tr>
    57  </table>
    58  
    59  <p>
    60  <sup>&#8224;</sup><code>gcc</code> is required only if you plan to use
    61  <a href="/cmd/cgo">cgo</a>.<br/>
    62  <sup>&#8225;</sup>You only need to install the command line tools for
    63  <a href="http://developer.apple.com/Xcode/">Xcode</a>. If you have already
    64  installed Xcode 4.3+, you can install it from the Components tab of the
    65  Downloads preferences panel.
    66  </p>
    67  
    68  <h2 id="install">Install the Go tools</h2>
    69  
    70  <p>
    71  The Go binary distributions assume they will be installed in
    72  <code>/usr/local/go</code> (or <code>c:\Go</code> under Windows),
    73  but it is possible to install them in a different
    74  location. If you do this, you will need to set the <code>GOROOT</code>
    75  environment variable to that directory when using the Go tools.
    76  </p>
    77  
    78  <p>
    79  For example, if you installed Go to your home directory you should add the
    80  following commands to <code>$HOME/.profile</code>:
    81  </p>
    82  
    83  <pre>
    84  export GOROOT=$HOME/go
    85  export PATH=$PATH:$GOROOT/bin
    86  </pre>
    87  
    88  <p>
    89  Windows users should read the section about <a href="#windows_env">setting
    90  environment variables under Windows</a>.
    91  </p>
    92  
    93  <h3 id="bsd_linux">FreeBSD, Linux, Mac OS X and NetBSD tarballs</h3>
    94  
    95  <p>
    96  If you are upgrading from an older version of Go you must
    97  first remove the existing version from <code>/usr/local/go</code>:
    98  </p>
    99  
   100  <pre>
   101  rm -r /usr/local/go
   102  </pre>
   103  
   104  <p>
   105  Extract <a href="http://code.google.com/p/go/downloads/list?q=OpSys-FreeBSD+OR+OpSys-Linux+OR+OpSys-OSX+OR+OpSys-NetBSD+Type-Archive">the archive</a>
   106  into <code>/usr/local</code>, creating a Go tree in <code>/usr/local/go</code>.
   107  For example:
   108  </p>
   109  
   110  <pre>
   111  tar -C /usr/local -xzf go1.1.linux-amd64.tar.gz
   112  </pre>
   113  
   114  <p>
   115  The name of the archive may differ, depending on the version of Go you are
   116  installing and your system's operating system and processor architecture.
   117  </p>
   118  
   119  <p>
   120  (Typically these commands must be run as root or through <code>sudo</code>.)
   121  </p>
   122  
   123  <p>
   124  Add <code>/usr/local/go/bin</code> to the <code>PATH</code> environment
   125  variable. You can do this by adding this line to your <code>/etc/profile</code>
   126  (for a system-wide installation) or <code>$HOME/.profile</code>:
   127  </p>
   128  
   129  <pre>
   130  export PATH=$PATH:/usr/local/go/bin
   131  </pre>
   132  
   133  <h3 id="osx">Mac OS X package installer</h3>
   134  
   135  <p>
   136  Open the <a href="http://code.google.com/p/go/downloads/list?q=OpSys-OSX+Type-Installer">package file</a>
   137  and follow the prompts to install the Go tools.
   138  The package installs the Go distribution to <code>/usr/local/go</code>.
   139  </p>
   140  
   141  <p>
   142  The package should put the <code>/usr/local/go/bin</code> directory in your
   143  <code>PATH</code> environment variable. You may need to restart any open
   144  Terminal sessions for the change to take effect.
   145  </p>
   146  
   147  <h3 id="windows">Windows</h3>
   148  
   149  <p>
   150  The Go project provides two installation options for Windows users
   151  (besides <a href="/doc/install/source">installing from source</a>):
   152  a zip archive that requires you to set some environment variables and an
   153  experimental MSI installer that configures your installation automatically.
   154  </p>
   155  
   156  <h4 id="windows_zip">Zip archive</h4>
   157  
   158  <p>
   159  Extract the <a href="http://code.google.com/p/go/downloads/list?q=OpSys-Windows+Type%3DArchive">zip file</a>
   160  to the directory of your choice (we suggest <code>c:\Go</code>).
   161  </p>
   162  
   163  <p>
   164  If you chose a directory other than <code>c:\Go</code>, you must set
   165  the <code>GOROOT</code> environment variable to your chosen path.
   166  </p>
   167  
   168  <p>
   169  Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\Go\bin</code>) to your <code>PATH</code> environment variable.
   170  </p>
   171  
   172  <h4 id="windows_msi">MSI installer (experimental)</h4>
   173  
   174  <p>
   175  Open the <a href="http://code.google.com/p/go/downloads/list?q=OpSys-Windows+Type%3DInstaller">MSI file</a>
   176  and follow the prompts to install the Go tools.
   177  By default, the installer puts the Go distribution in <code>c:\Go</code>.
   178  </p>
   179  
   180  <p>
   181  The installer should put the <code>c:\Go\bin</code> directory in your
   182  <code>PATH</code> environment variable. You may need to restart any open
   183  command prompts for the change to take effect.
   184  </p>
   185  
   186  <h4 id="windows_env">Setting environment variables under Windows</h4>
   187  
   188  <p>
   189  Under Windows, you may set environment variables through the "Environment
   190  Variables" button on the "Advanced" tab of the "System" control panel. Some
   191  versions of Windows provide this control panel through the "Advanced System
   192  Settings" option inside the "System" control panel.
   193  </p>
   194  
   195  <h2 id="testing">Test your installation</h2>
   196  
   197  <p>
   198  Check that Go is installed correctly by building a simple program, as follows.
   199  </p>
   200  
   201  <p>
   202  Create a file named <code>hello.go</code> and put the following program in it:
   203  </p>
   204  
   205  <pre>
   206  package main
   207  
   208  import "fmt"
   209  
   210  func main() {
   211      fmt.Printf("hello, world\n")
   212  }
   213  </pre>
   214  
   215  <p>
   216  Then run it with the <code>go</code> tool:
   217  </p>
   218  
   219  <pre>
   220  $ go run hello.go
   221  hello, world
   222  </pre>
   223  
   224  <p>
   225  If you see the "hello, world" message then your Go installation is working.
   226  </p>
   227  
   228  <h2 id="gopath">Set up your work environment</h2>
   229  
   230  <p>
   231  The document <a href="/doc/code.html">How to Write Go Code</a> explains how to
   232  set up a work environment in which to build and test Go code.
   233  </p>
   234  
   235  <h2 id="next">What's next</h2>
   236  
   237  <p>
   238  Start by taking <a href="http://code.google.com/p/go-tour/">A Tour of Go</a>.
   239  </p>
   240  
   241  <p>
   242  Build a web application by following the <a href="/doc/articles/wiki/">Wiki
   243  Tutorial</a>.
   244  </p>
   245  
   246  <p>
   247  Read <a href="/doc/effective_go.html">Effective Go</a> to learn about writing
   248  idiomatic Go code.
   249  </p>
   250  
   251  <p>
   252  For the full story, consult Go's extensive <a href="/doc/">documentation</a>.
   253  </p>
   254  
   255  <p>
   256  Subscribe to the
   257  <a href="http://groups.google.com/group/golang-announce">golang-announce</a>
   258  mailing list to be notified when a new stable version of Go is released.
   259  </p>
   260  
   261  
   262  <h2 id="community">Community resources</h2>
   263  
   264  <p>
   265  For real-time help, there may be users or developers on
   266  <code>#go-nuts</code> on the <a href="http://freenode.net/">Freenode</a> IRC server.
   267  </p>
   268  
   269  <p>
   270  The official mailing list for discussion of the Go language is
   271  <a href="http://groups.google.com/group/golang-nuts">Go Nuts</a>.
   272  </p>
   273  
   274  <p>
   275  Bugs should be reported using the
   276  <a href="http://code.google.com/p/go/issues/list">Go issue tracker</a>.
   277  </p>