"Fossies" - the Fresh Open Source Software Archive

Member "go/doc/install-source.html" (9 Sep 2020, 23200 Bytes) of package /windows/misc/go1.14.9.windows-386.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) HTML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <!--{
    2     "Title": "Installing Go from source",
    3     "Path": "/doc/install/source"
    4 }-->
    5 
    6 <h2 id="introduction">Introduction</h2>
    7 
    8 <p>
    9 Go is an open source project, distributed under a
   10 <a href="/LICENSE">BSD-style license</a>.
   11 This document explains how to check out the sources,
   12 build them on your own machine, and run them.
   13 </p>
   14 
   15 <p>
   16 Most users don't need to do this, and will instead install
   17 from precompiled binary packages as described in
   18 <a href="/doc/install">Getting Started</a>,
   19 a much simpler process.
   20 If you want to help develop what goes into those precompiled
   21 packages, though, read on.
   22 </p>
   23 
   24 <div class="detail">
   25 
   26 <p>
   27 There are two official Go compiler toolchains.
   28 This document focuses on the <code>gc</code> Go
   29 compiler and tools.
   30 For information on how to work on <code>gccgo</code>, a more traditional
   31 compiler using the GCC back end, see
   32 <a href="/doc/install/gccgo">Setting up and using gccgo</a>.
   33 </p>
   34 
   35 <p>
   36 The Go compilers support twelve instruction sets:
   37 
   38 <dl>
   39 <dt>
   40   <code>amd64</code>, <code>386</code>
   41 </dt>
   42 <dd>
   43   The <code>x86</code> instruction set, 64- and 32-bit.
   44 </dd>
   45 <dt>
   46   <code>arm64</code>, <code>arm</code>
   47 </dt>
   48 <dd>
   49   The <code>ARM</code> instruction set, 64-bit (<code>AArch64</code>) and 32-bit.
   50 </dd>
   51 <dt>
   52   <code>ppc64</code>, <code>ppc64le</code>
   53 </dt>
   54 <dd>
   55   The 64-bit PowerPC instruction set, big- and little-endian.
   56 </dd>
   57 <dt>
   58   <code>s390x</code>
   59 </dt>
   60 <dd>
   61   The IBM z/Architecture.
   62 </dd>
   63 <dt>
   64   <code>mips64</code>, <code>mips64le</code>, <code>mips</code>,  <code>mipsle</code>
   65 </dt>
   66 <dd>
   67   The <code>MIPS</code> instruction set, big- and little-endian, 64- and 32-bit.
   68 </dd>
   69 <dt>
   70   <code>wasm</code>
   71 </dt>
   72 <dd>
   73   <a href="https://webassembly.org">WebAssembly</a>.
   74 </dd>
   75 </dl>
   76 </p>
   77 
   78 <p>
   79 The compilers can target the AIX, Android, DragonFly BSD, FreeBSD,
   80 Illumos, Linux, macOS/iOS (Darwin), NetBSD, OpenBSD, Plan 9, Solaris,
   81 and Windows operating systems (although not all operating systems
   82 support all architectures).
   83 </p>
   84 
   85 <p>
   86 A list of ports which are considered "first class" is available at the
   87 <a href="/wiki/PortingPolicy#first-class-ports">first class ports</a>
   88 wiki page.
   89 </p>
   90 
   91 <p>
   92 The full set of supported combinations is listed in the
   93 discussion of <a href="#environment">environment variables</a> below.
   94 </p>
   95 
   96 <p>
   97 See the main installation page for the <a href="/doc/install#requirements">overall system requirements</a>.
   98 The following additional constraints apply to systems that can be built only from source:
   99 </p>
  100 
  101 <ul>
  102 <li>For Linux on PowerPC 64-bit, the minimum supported kernel version is 2.6.37, meaning that
  103 Go does not support CentOS 6 on these systems.
  104 </li>
  105 </ul>
  106 
  107 </div>
  108 
  109 <h2 id="go14">Install Go compiler binaries</h2>
  110 
  111 <p>
  112 The Go toolchain is written in Go. To build it, you need a Go compiler installed.
  113 The scripts that do the initial build of the tools look for an existing Go tool
  114 chain in <code>$GOROOT_BOOTSTRAP</code>.
  115 If unset, the default value of <code>GOROOT_BOOTSTRAP</code>
  116 is <code>$HOME/go1.4</code>.
  117 </p>
  118 
  119 <p>
  120 There are many options for the bootstrap toolchain.
  121 After obtaining one, set <code>GOROOT_BOOTSTRAP</code> to the
  122 directory containing the unpacked tree.
  123 For example, <code>$GOROOT_BOOTSTRAP/bin/go</code> should be
  124 the <code>go</code> command binary for the bootstrap toolchain.
  125 </p>
  126 
  127 <h3 id="bootstrapFromBinaryRelease">Bootstrap toolchain from binary release</h3>
  128 
  129 <p>
  130 To use a binary release as a bootstrap toolchain, see
  131 <a href="/dl/">the downloads page</a> or use any other
  132 packaged Go distribution.
  133 </p>
  134 
  135 <h3 id="bootstrapFromSource">Bootstrap toolchain from source</h3>
  136 
  137 <p>
  138 To build a bootstrap toolchain from source, use
  139 either the git branch <code>release-branch.go1.4</code> or
  140 <a href="https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz">go1.4-bootstrap-20171003.tar.gz</a>,
  141 which contains the Go 1.4 source code plus accumulated fixes
  142 to keep the tools running on newer operating systems.
  143 (Go 1.4 was the last distribution in which the toolchain was written in C.)
  144 After unpacking the Go 1.4 source, <code>cd</code> to
  145 the <code>src</code> subdirectory, set <code>CGO_ENABLED=0</code> in
  146 the environment, and run <code>make.bash</code> (or,
  147 on Windows, <code>make.bat</code>).
  148 </p>
  149 
  150 <p>
  151 Once the Go 1.4 source has been unpacked into your GOROOT_BOOTSTRAP directory,
  152 you must keep this git clone instance checked out to branch
  153 <code>release-branch.go1.4</code>.  Specifically, do not attempt to reuse
  154 this git clone in the later step named "Fetch the repository."  The go1.4
  155 bootstrap toolchain <b>must be able</b> to properly traverse the go1.4 sources
  156 that it assumes are present under this repository root.
  157 </p>
  158 
  159 <h3 id="bootstrapFromCrosscompiledSource">Bootstrap toolchain from cross-compiled source</h3>
  160 
  161 <p>
  162 To cross-compile a bootstrap toolchain from source, which is
  163 necessary on systems Go 1.4 did not target (for
  164 example, <code>linux/ppc64le</code>), install Go on a different system
  165 and run <a href="/src/bootstrap.bash">bootstrap.bash</a>.
  166 </p>
  167 
  168 <p>
  169 When run as (for example)
  170 </p>
  171 
  172 <pre>
  173 $ GOOS=linux GOARCH=ppc64 ./bootstrap.bash
  174 </pre>
  175 
  176 <p>
  177 <code>bootstrap.bash</code> cross-compiles a toolchain for that <code>GOOS/GOARCH</code>
  178 combination, leaving the resulting tree in <code>../../go-${GOOS}-${GOARCH}-bootstrap</code>.
  179 That tree can be copied to a machine of the given target type
  180 and used as <code>GOROOT_BOOTSTRAP</code> to bootstrap a local build.
  181 </p>
  182 
  183 <h3 id="bootstrapFromGccgo">Bootstrap toolchain using gccgo</h3>
  184 
  185 <p>
  186 To use gccgo as the bootstrap toolchain, you need to arrange
  187 for <code>$GOROOT_BOOTSTRAP/bin/go</code> to be the go tool that comes
  188 as part of gccgo 5. For example on Ubuntu Vivid:
  189 </p>
  190 
  191 <pre>
  192 $ sudo apt-get install gccgo-5
  193 $ sudo update-alternatives --set go /usr/bin/go-5
  194 $ GOROOT_BOOTSTRAP=/usr ./make.bash
  195 </pre>
  196 
  197 <h2 id="git">Install Git, if needed</h2>
  198 
  199 <p>
  200 To perform the next step you must have Git installed. (Check that you
  201 have a <code>git</code> command before proceeding.)
  202 </p>
  203 
  204 <p>
  205 If you do not have a working Git installation,
  206 follow the instructions on the
  207 <a href="https://git-scm.com/downloads">Git downloads</a> page.
  208 </p>
  209 
  210 <h2 id="ccompiler">(Optional) Install a C compiler</h2>
  211 
  212 <p>
  213 To build a Go installation
  214 with <code><a href="/cmd/cgo">cgo</a></code> support, which permits Go
  215 programs to import C libraries, a C compiler such as <code>gcc</code>
  216 or <code>clang</code> must be installed first. Do this using whatever
  217 installation method is standard on the system.
  218 </p>
  219 
  220 <p>
  221 To build without <code>cgo</code>, set the environment variable
  222 <code>CGO_ENABLED=0</code> before running <code>all.bash</code> or
  223 <code>make.bash</code>.
  224 </p>
  225 
  226 <h2 id="fetch">Fetch the repository</h2>
  227 
  228 <p>Change to the directory where you intend to install Go, and make sure
  229 the <code>goroot</code> directory does not exist. Then clone the repository
  230 and check out the latest release tag (<code class="versionTag">go1.12</code>,
  231 for example):</p>
  232 
  233 <pre>
  234 $ git clone https://go.googlesource.com/go goroot
  235 $ cd goroot
  236 $ git checkout <span class="versionTag"><i>&lt;tag&gt;</i></span>
  237 </pre>
  238 
  239 <p class="whereTag">
  240 Where <code>&lt;tag&gt;</code> is the version string of the release.
  241 </p>
  242 
  243 <p>Go will be installed in the directory where it is checked out. For example,
  244 if Go is checked out in <code>$HOME/goroot</code>, executables will be installed
  245 in <code>$HOME/goroot/bin</code>. The directory may have any name, but note
  246 that if Go is checked out in <code>$HOME/go</code>, it will conflict with
  247 the default location of <code>$GOPATH</code>.
  248 See <a href="#gopath"><code>GOPATH</code></a> below.</p>
  249 
  250 <p>
  251 Reminder: If you opted to also compile the bootstrap binaries from source (in an
  252 earlier section), you still need to <code>git clone</code> again at this point
  253 (to checkout the latest <code>&lt;tag&gt;</code>), because you must keep your
  254 go1.4 repository distinct.
  255 </p>
  256 
  257 <h2 id="head">(Optional) Switch to the master branch</h2>
  258 
  259 <p>If you intend to modify the go source code, and
  260 <a href="/doc/contribute.html">contribute your changes</a>
  261 to the project, then move your repository
  262 off the release branch, and onto the master (development) branch.
  263 Otherwise, skip this step.</p>
  264 
  265 <pre>
  266 $ git checkout master
  267 </pre>
  268 
  269 <h2 id="install">Install Go</h2>
  270 
  271 <p>
  272 To build the Go distribution, run
  273 </p>
  274 
  275 <pre>
  276 $ cd src
  277 $ ./all.bash
  278 </pre>
  279 
  280 <p>
  281 (To build under Windows use <code>all.bat</code>.)
  282 </p>
  283 
  284 <p>
  285 If all goes well, it will finish by printing output like:
  286 </p>
  287 
  288 <pre>
  289 ALL TESTS PASSED
  290 
  291 ---
  292 Installed Go for linux/amd64 in /home/you/go.
  293 Installed commands in /home/you/go/bin.
  294 *** You need to add /home/you/go/bin to your $PATH. ***
  295 </pre>
  296 
  297 <p>
  298 where the details on the last few lines reflect the operating system,
  299 architecture, and root directory used during the install.
  300 </p>
  301 
  302 <div class="detail">
  303 <p>
  304 For more information about ways to control the build, see the discussion of
  305 <a href="#environment">environment variables</a> below.
  306 <code>all.bash</code> (or <code>all.bat</code>) runs important tests for Go,
  307 which can take more time than simply building Go. If you do not want to run
  308 the test suite use <code>make.bash</code> (or <code>make.bat</code>)
  309 instead.
  310 </p>
  311 </div>
  312 
  313 
  314 <h2 id="testing">Testing your installation</h2>
  315 
  316 <p>
  317 Check that Go is installed correctly by building a simple program.
  318 </p>
  319 
  320 <p>
  321 Create a file named <code>hello.go</code> and put the following program in it:
  322 </p>
  323 
  324 <pre>
  325 package main
  326 
  327 import "fmt"
  328 
  329 func main() {
  330     fmt.Printf("hello, world\n")
  331 }
  332 </pre>
  333 
  334 <p>
  335 Then run it with the <code>go</code> tool:
  336 </p>
  337 
  338 <pre>
  339 $ go run hello.go
  340 hello, world
  341 </pre>
  342 
  343 <p>
  344 If you see the "hello, world" message then Go is installed correctly.
  345 </p>
  346 
  347 <h2 id="gopath">Set up your work environment</h2>
  348 
  349 <p>
  350 You're almost done.
  351 You just need to do a little more setup.
  352 </p>
  353 
  354 <p>
  355 <a href="/doc/code.html" class="download" id="start">
  356 <span class="big">How to Write Go Code</span>
  357 <span class="desc">Learn how to set up and use the Go tools</span>
  358 </a>
  359 </p>
  360 
  361 <p>
  362 The <a href="/doc/code.html">How to Write Go Code</a> document
  363 provides <b>essential setup instructions</b> for using the Go tools.
  364 </p>
  365 
  366 
  367 <h2 id="tools">Install additional tools</h2>
  368 
  369 <p>
  370 The source code for several Go tools (including <a href="/cmd/godoc/">godoc</a>)
  371 is kept in <a href="https://golang.org/x/tools">the go.tools repository</a>.
  372 To install one of the tools (<code>godoc</code> in this case):
  373 </p>
  374 
  375 <pre>
  376 $ go get golang.org/x/tools/cmd/godoc
  377 </pre>
  378 
  379 <p>
  380 To install these tools, the <code>go</code> <code>get</code> command requires
  381 that <a href="#git">Git</a> be installed locally.
  382 </p>
  383 
  384 <p>
  385 You must also have a workspace (<code>GOPATH</code>) set up;
  386 see <a href="/doc/code.html">How to Write Go Code</a> for the details.
  387 </p>
  388 
  389 <h2 id="community">Community resources</h2>
  390 
  391 <p>
  392 The usual community resources such as
  393 <code>#go-nuts</code> on the <a href="https://freenode.net/">Freenode</a> IRC server
  394 and the
  395 <a href="//groups.google.com/group/golang-nuts">Go Nuts</a>
  396 mailing list have active developers that can help you with problems
  397 with your installation or your development work.
  398 For those who wish to keep up to date,
  399 there is another mailing list, <a href="//groups.google.com/group/golang-checkins">golang-checkins</a>,
  400 that receives a message summarizing each checkin to the Go repository.
  401 </p>
  402 
  403 <p>
  404 Bugs can be reported using the <a href="//golang.org/issue/new">Go issue tracker</a>.
  405 </p>
  406 
  407 
  408 <h2 id="releases">Keeping up with releases</h2>
  409 
  410 <p>
  411 New releases are announced on the
  412 <a href="//groups.google.com/group/golang-announce">golang-announce</a>
  413 mailing list.
  414 Each announcement mentions the latest release tag, for instance,
  415 <code class="versionTag">go1.9</code>.
  416 </p>
  417 
  418 <p>
  419 To update an existing tree to the latest release, you can run:
  420 </p>
  421 
  422 <pre>
  423 $ cd go/src
  424 $ git fetch
  425 $ git checkout <span class="versionTag"><i>&lt;tag&gt;</i></psan>
  426 $ ./all.bash
  427 </pre>
  428 
  429 <p class="whereTag">
  430 Where <code>&lt;tag&gt;</code> is the version string of the release.
  431 </p>
  432 
  433 
  434 <h2 id="environment">Optional environment variables</h2>
  435 
  436 <p>
  437 The Go compilation environment can be customized by environment variables.
  438 <i>None is required by the build</i>, but you may wish to set some
  439 to override the defaults.
  440 </p>
  441 
  442 <ul>
  443 <li><code>$GOROOT</code>
  444 <p>
  445 The root of the Go tree, often <code>$HOME/go1.X</code>.
  446 Its value is built into the tree when it is compiled, and
  447 defaults to the parent of the directory where <code>all.bash</code> was run.
  448 There is no need to set this unless you want to switch between multiple
  449 local copies of the repository.
  450 </p>
  451 </li>
  452 
  453 <li><code>$GOROOT_FINAL</code>
  454 <p>
  455 The value assumed by installed binaries and scripts when
  456 <code>$GOROOT</code> is not set explicitly.
  457 It defaults to the value of <code>$GOROOT</code>.
  458 If you want to build the Go tree in one location
  459 but move it elsewhere after the build, set
  460 <code>$GOROOT_FINAL</code> to the eventual location.
  461 </p>
  462 </li>
  463 
  464 <li id="gopath"><code>$GOPATH</code>
  465 <p>
  466 The directory where Go projects outside the Go distribution are typically
  467 checked out. For example, <code>golang.org/x/tools</code> might be checked out
  468 to <code>$GOPATH/src/golang.org/x/tools</code>. Executables outside the
  469 Go distribution are installed in <code>$GOPATH/bin</code> (or
  470 <code>$GOBIN</code>, if set). Modules are downloaded and cached in
  471 <code>$GOPATH/pkg/mod</code>.
  472 </p>
  473 
  474 <p>The default location of <code>$GOPATH</code> is <code>$HOME/go</code>,
  475 and it's not usually necessary to set <code>GOPATH</code> explicitly. However,
  476 if you have checked out the Go distribution to <code>$HOME/go</code>,
  477 you must set <code>GOPATH</code> to another location to avoid conflicts.
  478 </p>
  479 </li>
  480 
  481 <li><code>$GOBIN</code>
  482 <p>
  483 The directory where executables outside the Go distribution are installed
  484 using the <a href="/cmd/go">go command</a>. For example,
  485 <code>go get golang.org/x/tools/cmd/godoc</code> downloads, builds, and
  486 installs <code>$GOBIN/godoc</code>. By default, <code>$GOBIN</code> is
  487 <code>$GOPATH/bin</code> (or <code>$HOME/go/bin</code> if <code>GOPATH</code>
  488 is not set). After installing, you will want to add this directory to
  489 your <code>$PATH</code> so you can use installed tools.
  490 </p>
  491 
  492 <p>
  493 Note that the Go distribution's executables are installed in
  494 <code>$GOROOT/bin</code> (for executables invoked by people) or
  495 <code>$GOTOOLDIR</code> (for executables invoked by the go command;
  496 defaults to <code>$GOROOT/pkg/$GOOS_GOARCH</code>) instead of
  497 <code>$GOBIN</code>.
  498 </p>
  499 </li>
  500 
  501 <li><code>$GOOS</code> and <code>$GOARCH</code>
  502 <p>
  503 The name of the target operating system and compilation architecture.
  504 These default to the values of <code>$GOHOSTOS</code> and
  505 <code>$GOHOSTARCH</code> respectively (described below).
  506 </li>
  507 
  508 <p>
  509 Choices for <code>$GOOS</code> are
  510 <code>android</code>, <code>darwin</code> (macOS 10.11 and above and iOS),
  511 <code>dragonfly</code>, <code>freebsd</code>, <code>illumos</code>, <code>js</code>,
  512 <code>linux</code>, <code>netbsd</code>, <code>openbsd</code>,
  513 <code>plan9</code>, <code>solaris</code> and <code>windows</code>.
  514 </p>
  515 
  516 <p>
  517 Choices for <code>$GOARCH</code> are
  518 <code>amd64</code> (64-bit x86, the most mature port),
  519 <code>386</code> (32-bit x86), <code>arm</code> (32-bit ARM), <code>arm64</code> (64-bit ARM),
  520 <code>ppc64le</code> (PowerPC 64-bit, little-endian), <code>ppc64</code> (PowerPC 64-bit, big-endian),
  521 <code>mips64le</code> (MIPS 64-bit, little-endian), <code>mips64</code> (MIPS 64-bit, big-endian),
  522 <code>mipsle</code> (MIPS 32-bit, little-endian), <code>mips</code> (MIPS 32-bit, big-endian),
  523 <code>s390x</code> (IBM System z 64-bit, big-endian), and
  524 <code>wasm</code> (WebAssembly 32-bit).
  525 </p>
  526 
  527 <p>
  528 The valid combinations of <code>$GOOS</code> and <code>$GOARCH</code> are:
  529 <table cellpadding="0">
  530 <tr>
  531 <th width="50"></th><th align="left" width="100"><code>$GOOS</code></th> <th align="left" width="100"><code>$GOARCH</code></th>
  532 </tr>
  533 <tr>
  534 <td></td><td><code>aix</code></td> <td><code>ppc64</code></td>
  535 </tr>
  536 <tr>
  537 <td></td><td><code>android</code></td> <td><code>386</code></td>
  538 </tr>
  539 <tr>
  540 <td></td><td><code>android</code></td> <td><code>amd64</code></td>
  541 </tr>
  542 <tr>
  543 <td></td><td><code>android</code></td> <td><code>arm</code></td>
  544 </tr>
  545 <tr>
  546 <td></td><td><code>android</code></td> <td><code>arm64</code></td>
  547 </tr>
  548 <tr>
  549 <td></td><td><code>darwin</code></td> <td><code>386</code></td>
  550 </tr>
  551 <tr>
  552 <td></td><td><code>darwin</code></td> <td><code>amd64</code></td>
  553 </tr>
  554 <tr>
  555 <td></td><td><code>darwin</code></td> <td><code>arm</code></td>
  556 </tr>
  557 <tr>
  558 <td></td><td><code>darwin</code></td> <td><code>arm64</code></td>
  559 </tr>
  560 <tr>
  561 <td></td><td><code>dragonfly</code></td> <td><code>amd64</code></td>
  562 </tr>
  563 <tr>
  564 <td></td><td><code>freebsd</code></td> <td><code>386</code></td>
  565 </tr>
  566 <tr>
  567 <td></td><td><code>freebsd</code></td> <td><code>amd64</code></td>
  568 </tr>
  569 <tr>
  570 <td></td><td><code>freebsd</code></td> <td><code>arm</code></td>
  571 </tr>
  572 <tr>
  573 <td></td><td><code>illumos</code></td> <td><code>amd64</code></td>
  574 </tr>
  575 <tr>
  576 <td></td><td><code>js</code></td> <td><code>wasm</code></td>
  577 </tr>
  578 <tr>
  579 <td></td><td><code>linux</code></td> <td><code>386</code></td>
  580 </tr>
  581 <tr>
  582 <td></td><td><code>linux</code></td> <td><code>amd64</code></td>
  583 </tr>
  584 <tr>
  585 <td></td><td><code>linux</code></td> <td><code>arm</code></td>
  586 </tr>
  587 <tr>
  588 <td></td><td><code>linux</code></td> <td><code>arm64</code></td>
  589 </tr>
  590 <tr>
  591 <td></td><td><code>linux</code></td> <td><code>ppc64</code></td>
  592 </tr>
  593 <tr>
  594 <td></td><td><code>linux</code></td> <td><code>ppc64le</code></td>
  595 </tr>
  596 <tr>
  597 <td></td><td><code>linux</code></td> <td><code>mips</code></td>
  598 </tr>
  599 <tr>
  600 <td></td><td><code>linux</code></td> <td><code>mipsle</code></td>
  601 </tr>
  602 <tr>
  603 <td></td><td><code>linux</code></td> <td><code>mips64</code></td>
  604 </tr>
  605 <tr>
  606 <td></td><td><code>linux</code></td> <td><code>mips64le</code></td>
  607 </tr>
  608 <tr>
  609 <td></td><td><code>linux</code></td> <td><code>s390x</code></td>
  610 </tr>
  611 <tr>
  612 <td></td><td><code>netbsd</code></td> <td><code>386</code></td>
  613 </tr>
  614 <tr>
  615 <td></td><td><code>netbsd</code></td> <td><code>amd64</code></td>
  616 </tr>
  617 <tr>
  618 <td></td><td><code>netbsd</code></td> <td><code>arm</code></td>
  619 </tr>
  620 <tr>
  621 <td></td><td><code>openbsd</code></td> <td><code>386</code></td>
  622 </tr>
  623 <tr>
  624 <td></td><td><code>openbsd</code></td> <td><code>amd64</code></td>
  625 </tr>
  626 <tr>
  627 <td></td><td><code>openbsd</code></td> <td><code>arm</code></td>
  628 </tr>
  629 <tr>
  630 <td></td><td><code>openbsd</code></td> <td><code>arm64</code></td>
  631 </tr>
  632 <tr>
  633 <td></td><td><code>plan9</code></td> <td><code>386</code></td>
  634 </tr>
  635 <tr>
  636 <td></td><td><code>plan9</code></td> <td><code>amd64</code></td>
  637 </tr>
  638 <tr>
  639 <td></td><td><code>plan9</code></td> <td><code>arm</code></td>
  640 </tr>
  641 <tr>
  642 <td></td><td><code>solaris</code></td> <td><code>amd64</code></td>
  643 </tr>
  644 <tr>
  645 <td></td><td><code>windows</code></td> <td><code>386</code></td>
  646 </tr>
  647 <tr>
  648 <td></td><td><code>windows</code></td> <td><code>amd64</code></td>
  649 </tr>
  650 </table>
  651 <br>
  652 
  653 <li><code>$GOHOSTOS</code> and <code>$GOHOSTARCH</code>
  654 <p>
  655 The name of the host operating system and compilation architecture.
  656 These default to the local system's operating system and
  657 architecture.
  658 </p>
  659 </li>
  660 
  661 <p>
  662 Valid choices are the same as for <code>$GOOS</code> and
  663 <code>$GOARCH</code>, listed above.
  664 The specified values must be compatible with the local system.
  665 For example, you should not set <code>$GOHOSTARCH</code> to
  666 <code>arm</code> on an x86 system.
  667 </p>
  668 
  669 <li><code>$GO386</code> (for <code>386</code> only, default is auto-detected
  670 if built on either <code>386</code> or <code>amd64</code>, <code>387</code> otherwise)
  671 <p>
  672 This controls the code generated by gc to use either the 387 floating-point unit
  673 (set to <code>387</code>) or SSE2 instructions (set to <code>sse2</code>) for
  674 floating point computations.
  675 </p>
  676 <ul>
  677     <li><code>GO386=387</code>: use x87 for floating point operations; should support all x86 chips (Pentium MMX or later).</li>
  678     <li><code>GO386=sse2</code>: use SSE2 for floating point operations; has better performance than 387, but only available on Pentium 4/Opteron/Athlon 64 or later.</li>
  679 </ul>
  680 </li>
  681 
  682 <li><code>$GOARM</code> (for <code>arm</code> only; default is auto-detected if building
  683 on the target processor, 6 if not)
  684 <p>
  685 This sets the ARM floating point co-processor architecture version the run-time
  686 should target. If you are compiling on the target system, its value will be auto-detected.
  687 </p>
  688 <ul>
  689     <li><code>GOARM=5</code>: use software floating point; when CPU doesn't have VFP co-processor</li>
  690     <li><code>GOARM=6</code>: use VFPv1 only; default if cross compiling; usually ARM11 or better cores (VFPv2 or better is also supported)</li>
  691     <li><code>GOARM=7</code>: use VFPv3; usually Cortex-A cores</li>
  692 </ul>
  693 <p>
  694 If in doubt, leave this variable unset, and adjust it if required
  695 when you first run the Go executable.
  696 The <a href="//golang.org/wiki/GoArm">GoARM</a> page
  697 on the <a href="//golang.org/wiki">Go community wiki</a>
  698 contains further details regarding Go's ARM support.
  699 </p>
  700 </li>
  701 
  702 <li><code>$GOMIPS</code> (for <code>mips</code> and <code>mipsle</code> only) <br> <code>$GOMIPS64</code> (for <code>mips64</code> and <code>mips64le</code> only)
  703 <p>
  704     These variables set whether to use floating point instructions. Set to "<code>hardfloat</code>" to use floating point instructions; this is the default.  Set to "<code>softfloat</code>" to use soft floating point.
  705 </p>
  706 </li>
  707 
  708 <li><code>$GOPPC64</code> (for <code>ppc64</code> and <code>ppc64le</code> only)
  709 <p>
  710 This variable sets the processor level (i.e. Instruction Set Architecture version)
  711 for which the compiler will target. The default is <code>power8</code>.
  712 </p>
  713 <ul>
  714     <li><code>GOPPC64=power8</code>: generate ISA v2.07 instructions</li>
  715     <li><code>GOPPC64=power9</code>: generate ISA v3.00 instructions</li>
  716 </ul>
  717 </li>
  718 
  719 
  720 <li><code>$GOWASM</code> (for <code>wasm</code> only)
  721     <p>
  722     This variable is a comma separated list of <a href="https://github.com/WebAssembly/proposals">experimental WebAssembly features</a> that the compiled WebAssembly binary is allowed to use.
  723     The default is to use no experimental features.
  724     </p>
  725     <ul>
  726         <li><code>GOWASM=satconv</code>: generate <a href="https://github.com/WebAssembly/nontrapping-float-to-int-conversions/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md">saturating (non-trapping) float-to-int conversions</a></li>
  727         <li><code>GOWASM=signext</code>: generate <a href="https://github.com/WebAssembly/sign-extension-ops/blob/master/proposals/sign-extension-ops/Overview.md">sign-extension operators</a></li>
  728     </ul>
  729 </li>
  730 
  731 </ul>
  732 
  733 <p>
  734 Note that <code>$GOARCH</code> and <code>$GOOS</code> identify the
  735 <em>target</em> environment, not the environment you are running on.
  736 In effect, you are always cross-compiling.
  737 By architecture, we mean the kind of binaries
  738 that the target environment can run:
  739 an x86-64 system running a 32-bit-only operating system
  740 must set <code>GOARCH</code> to <code>386</code>,
  741 not <code>amd64</code>.
  742 </p>
  743 
  744 <p>
  745 If you choose to override the defaults,
  746 set these variables in your shell profile (<code>$HOME/.bashrc</code>,
  747 <code>$HOME/.profile</code>, or equivalent). The settings might look
  748 something like this:
  749 </p>
  750 
  751 <pre>
  752 export GOARCH=amd64
  753 export GOOS=linux
  754 </pre>
  755 
  756 <p>
  757 although, to reiterate, none of these variables needs to be set to build,
  758 install, and develop the Go tree.
  759 </p>