From: Rob Pike
There are two distinct ways to experiment with Go.
-This document explains how to check out, build, and use the 6g
Go
-compiler and tools.
+This document explains how to check out, build, and use the gc
Go
+compiler and tools (6g
, 8g
etc.).
For information on how to use gccgo
, a more traditional
-compiler using the gcc back end, see
+compiler using the GCC back end, see
Setting up and using gccgo.
.bashrc
or equivalent,
plus one optional variable:
$GOROOT
$GOROOT
+$HOME/go
-but it can be any directory.$GOOS
and $GOARCH
$GOOS
are darwin
(OS X), linux
,
-and nacl
(Native Client, an incomplete port).
-Choices for $GOARCH
are amd64
(64-bit x86, the most stable port),
-386
(32-bit x86, an unoptimized but stable port), and
-arm
(32-bit ARM, an incomplete port).
-The valid combinations are
-linux
/amd64
,
-linux
/arm
,
-linux
/386
,
-darwin
/amd64
,
-darwin
/386
,
-and
-nacl
/386
.
+ but it can be any directory.
$GOBIN
(optional)$GOBIN
, you need to ensure that it
-is in your $PATH
so that newly built Go-specific
-command such as the compiler can be found during the build.
-The default, $HOME/bin
, may already be in your $PATH
.
+
+$GOOS
and $GOARCH
+$GOOS
are linux
,
+ darwin
(Mac OS X 10.5 or 10.6),
+ and nacl
(Native Client, an incomplete port).
+ Choices for $GOARCH
are amd64
(64-bit x86, the most stable port),
+ 386
(32-bit x86, an unoptimized but stable port), and
+ arm
(32-bit ARM, an incomplete port).
+ The valid combinations are
+ linux
/amd64
,
+ linux
/arm
,
+ linux
/386
,
+ darwin
/amd64
,
+ darwin
/386
,
+ and
+ nacl
/386
.
+$GOBIN
(optional)
+$GOBIN
, you need to ensure that it
+ is in your $PATH
so that newly built Go-specific
+ command such as the compiler can be found during the build.
+ The default, $HOME/bin
, may already be in your $PATH
.
+Go compilers support two operating systems (Linux, Mac OS X) and +three instruction sets. +The versions for Linux and Mac are equally capable except that the ARM port +does not run on OS X (yet). +
++There are important differences in the quality of the compilers for the different +architectures. +
+ +amd64
(a.k.a. x86-64
); 6g,6l,6c,6a
+gccgo
+ can do noticeably better sometimes).
+386
(a.k.a. x86
or x86-32
); 8g,8l,8c,8a
+amd64
port, but there is no
+ optimizer. Work is underway.
+arm
(a.k.a. ARM
); 5g,5l,5c,5a
++Except for things like low-level operating system interface code, the runtime +support is the same in all ports and includes a mark-and-sweep garbage collector +(a fancier one is in the works), efficient array and string slicing, +support for segmented stacks, and a strong goroutine implementation. +
+ +
+See the separate gccgo
document
+for details about that compiler and environment.
+
@@ -189,9 +252,12 @@ The linker learns about them by reading hello.6
.
To build more complicated programs, you will probably
want to use a
Makefile
.
-There are examples in $GOROOT/src/cmd/godoc/Makefile
+There are examples in places like
+$GOROOT/src/cmd/godoc/Makefile
and $GOROOT/src/pkg/*/Makefile
.
-XXX other document XXX gives more detail about
+The
+document
+about contributing to the Go project
+gives more detail about
the process of building and testing Go programs.