From: Andrew Gerrand
-
+
Download Go
Click here to visit the downloads page
@@ -60,6 +62,8 @@ installed Xcode 4.3+, you can install it from the Components tab of the
Downloads preferences panel.
Download the Go distribution
Install the Go tools
@@ -68,6 +72,8 @@ If you are upgrading from an older version of Go you must
first remove the existing version.
@@ -77,10 +83,10 @@ and extract it into /usr/local
, creating a Go tree in
-tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
+tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
-+
Choose the archive file appropriate for your installation.
For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux,
the archive you want is called go1.2.1.linux-amd64.tar.gz
.
@@ -125,6 +131,10 @@ export PATH=$PATH:$GOROOT/bin
location.
@@ -139,15 +149,21 @@ The package should put the /usr/local/go/bin
directory in your
Terminal sessions for the change to take effect.
+
The Go project provides two installation options for Windows users (besides installing from source): a zip archive that requires you to set some environment variables and an MSI installer that configures your installation automatically.
+
@@ -162,6 +178,10 @@ The installer should put the c:\Go\bin
directory in your
command prompts for the change to take effect.
@@ -177,6 +197,8 @@ you must set the GOROOT
environment variable to your chosen path.
Add the bin
subdirectory of your Go root (for example, c:\Go\bin
) to your PATH
environment variable.
@@ -186,15 +208,38 @@ versions of Windows provide this control panel through the "Advanced System Settings" option inside the "System" control panel.
+-Check that Go is installed correctly by building a simple program, as follows. +Check that Go is installed correctly by setting up a workspace +and building a simple program, as follows. +
+ +
+Create a directory to contain your workspace,
+$HOME/work
for example, and set the GOPATH
environment
+variable to point to that location.
+
+$ export GOPATH=$HOME/work ++ +
+You should put the above command in your shell startup script
+($HOME/.profile
for example) or, if you use Windows,
+follow the instructions above to set the
+GOPATH
environment variable on your system.
-Create a file named hello.go
and put the following program in it:
+Next, make the directories src/github.com/user/hello
inside your
+workspace (if you use GitHub, substitute your user name for user
),
+and inside the hello
directory create a file named hello.go
+with the following contents:
@@ -208,29 +253,32 @@ func main() {
-Then run it with the go
tool:
+Then compile it with the go
tool:
-$ go run hello.go -hello, world +$ go install github.com/user/hello
-If you see the "hello, world" message then your Go installation is working.
+The above command will put an executable command named hello
+(or hello.exe
) inside the bin
directory of your workspace.
+Execute the command to see the greeting:
+$ $GOPATH/bin/hello +hello, world +
-You're almost done. -You just need to set up your environment. +If you see the "hello, world" message then your Go installation is working.
-Read the How to Write Go Code document, -which provides essential setup instructions for using the Go tools. +Before rushing off to write Go code please read the +How to Write Go Code document, +which describes some essential concepts about using the Go tools.
diff --git a/doc/root.html b/doc/root.html index 3c6de2e46c..1217368530 100644 --- a/doc/root.html +++ b/doc/root.html @@ -53,7 +53,7 @@ simple, reliable, and efficient software. - + Download Go Binary distributions available for