From 31b0b73924e83fe3341e5c5ebca8854febcb3157 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Wed, 5 Aug 2015 11:58:44 +1000 Subject: [PATCH] doc: adjust installation instructions dynamically for a given download This change allows the download page to redirect the user to /doc/install?download=filename so the user can see installation instructions specific to the file they are downloading. This change also expands the "Test your Go installation" section to instruct the user to create a workspace, hopefully leading to less confusion down the line. It also changes the front page download link to go directly to the downloads page, which will in turn take them to the installation instructions (the original destination). This is related to this change to the tools repo: https://golang.org/cl/13180 Change-Id: I658327bdb93ad228fb1846e389b281b15da91b1d Reviewed-on: https://go-review.googlesource.com/13151 Reviewed-by: Chris Broadfoot --- doc/install.html | 80 ++++++++++++++++++++++++++++++++++++++---------- doc/root.html | 2 +- 2 files changed, 65 insertions(+), 17 deletions(-) diff --git a/doc/install.html b/doc/install.html index d94d6a9368b80a..9264f3a0d07a02 100644 --- a/doc/install.html +++ b/doc/install.html @@ -3,10 +3,12 @@ "Path": "/doc/install" }--> +
+

Download the Go distribution

- + Download Go Click here to visit the downloads page @@ -60,6 +62,8 @@

System requirements

Downloads preferences panel.

+
+

Install the Go tools

@@ -68,6 +72,8 @@

Install the Go tools

first remove the existing version.

+
+

Linux, Mac OS X, and FreeBSD tarballs

@@ -77,10 +83,10 @@

Linux, Mac OS X, and FreeBSD tarballs

-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 @@

Installing to a custom location

location.

+
+ +
+

Mac OS X package installer

@@ -139,15 +149,21 @@

Mac OS X package installer

Terminal sessions for the change to take effect.

+
+ +
+

Windows

-

+

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.

+
+

MSI installer

@@ -162,6 +178,10 @@

MSI installer

command prompts for the change to take effect.

+
+ +
+

Zip archive

@@ -177,6 +197,8 @@

Zip archive

Add the bin subdirectory of your Go root (for example, c:\Go\bin) to your PATH environment variable.

+
+

Setting environment variables under Windows

@@ -186,15 +208,38 @@

Setting environment variables under Windows

Settings" option inside the "System" control panel.

+
+

Test your installation

-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 @@ 

Test your installation

-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:

- -

Set up your work environment

+
+$ $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 3c6de2e46c7245..121736853002e9 100644 --- a/doc/root.html +++ b/doc/root.html @@ -53,7 +53,7 @@
- + Download Go Binary distributions available for