From: Andrew Gerrand Date: Wed, 5 Aug 2015 01:58:44 +0000 (+1000) Subject: doc: adjust installation instructions dynamically for a given download X-Git-Tag: go1.5rc1~26 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=31b0b73924e83fe3341e5c5ebca8854febcb3157;p=gostls13.git 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 --- diff --git a/doc/install.html b/doc/install.html index d94d6a9368..9264f3a0d0 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 @@ installed Xcode 4.3+, you can install it from the Components tab of the Downloads preferences panel.

+
+

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.

+
+

Linux, Mac OS X, and FreeBSD tarballs

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

+
+ +
+

Mac OS X package installer

@@ -139,15 +149,21 @@ The package should put the /usr/local/go/bin directory in your 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 @@ The installer should put the c:\Go\bin directory in your command prompts for the change to take effect.

+
+ +
+

Zip archive

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

+
+

Setting environment variables under Windows

@@ -186,15 +208,38 @@ versions of Windows provide this control panel through the "Advanced System 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 @@ 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:

- -

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