Merge pull request #788 from vCaesar/up10-pr
Update go install and fix set Go env
This commit is contained in:
25
en/01.1.md
25
en/01.1.md
@@ -76,15 +76,15 @@ A 64-bit operating system will show the following:
|
||||
|
||||
### Mac
|
||||
|
||||
Go to the [download page](https://golang.org/dl/), choose `go1.4.2.darwin-386.pkg` for 32-bit systems and `go1.7.4.darwin-amd64.pkg` for 64-bit systems. Going all the way to the end by clicking "next", `~/go/bin` will be added to your system's $PATH after you finish the installation. Now open the terminal and type `go`. You should see the same output shown in figure 1.1.
|
||||
Go to the [download page](https://golang.org/dl/), choose `go1.4.2.darwin-386.pkg` (The later version has no 32-bit download.)for 32-bit systems and `go1.8.darwin-amd64.pkg` for 64-bit systems. Going all the way to the end by clicking "next", `~/go/bin` will be added to your system's $PATH after you finish the installation. Now open the terminal and type `go`. You should see the same output shown in figure 1.1.
|
||||
|
||||
### Linux
|
||||
|
||||
Go to the [download page](https://golang.org/dl/), choose `go1.7.4.linux-386.tar.gz` for 32-bit systems and `go1.7.4.linux-amd64.tar.gz` for 64-bit systems. Suppose you want to install Go in the `$GO_INSTALL_DIR` path. Uncompress the `tar.gz` to your chosen path using the command `tar zxvf go1.7.4.linux-amd64.tar.gz -C $GO_INSTALL_DIR`. Then set your $PATH with the following: `export PATH=$PATH:$GO_INSTALL_DIR/go/bin`. Now just open the terminal and type `go`. You should now see the same output displayed in figure 1.1.
|
||||
Go to the [download page](https://golang.org/dl/), choose `go1.8.linux-386.tar.gz` for 32-bit systems and `go1.8.linux-amd64.tar.gz` for 64-bit systems. Suppose you want to install Go in the `$GO_INSTALL_DIR` path. Uncompress the `tar.gz` to your chosen path using the command `tar zxvf go1.8.linux-amd64.tar.gz -C $GO_INSTALL_DIR`. Then set your $PATH with the following: `export PATH=$PATH:$GO_INSTALL_DIR/go/bin`. Now just open the terminal and type `go`. You should now see the same output displayed in figure 1.1.
|
||||
|
||||
### Windows
|
||||
|
||||
Go to the [download page](https://golang.org/dl/), choose `go1.7.4.windows-386.msi` for 32-bit systems and `go1.7.4.windows-amd64.msi` for 64-bit systems. Going all the way to the end by clicking "next", `c:/go/bin` will be added to `path`. Now just open a command line window and type `go`. You should now see the same output displayed in figure 1.1.
|
||||
Go to the [download page](https://golang.org/dl/), choose `go1.8.windows-386.msi` for 32-bit systems and `go1.8.windows-amd64.msi` for 64-bit systems. Going all the way to the end by clicking "next", `c:/go/bin` will be added to `path`. Now just open a command line window and type `go`. You should now see the same output displayed in figure 1.1.
|
||||
|
||||
## Use third-party tools
|
||||
|
||||
@@ -96,8 +96,8 @@ GVM is a Go multi-version control tool developed by a third-party, like rvm for
|
||||
|
||||
Then we install Go using the following commands:
|
||||
|
||||
gvm install go1.7.4
|
||||
gvm use go1.7.4
|
||||
gvm install go1.8
|
||||
gvm use go1.8
|
||||
|
||||
After the process has finished, you're all set.
|
||||
|
||||
@@ -112,13 +112,16 @@ Ubuntu is the most popular desktop release version of Linux. It uses `apt-get` t
|
||||
###wget
|
||||
```sh
|
||||
|
||||
wget https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
|
||||
sudo tar -xzf go1.7.4.linux-amd64.tar.gz -C /usr/local
|
||||
export PATH=PATH:/usr/local/go/binexportGOROOT=HOME/go
|
||||
export PATH=PATH:GOROOT/bin
|
||||
export GOPATH=HOME/gowork
|
||||
```
|
||||
wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
|
||||
sudo tar -xzf go1.8.linux-amd64.tar.gz -C /usr/local
|
||||
|
||||
# Go environment
|
||||
export GOROOT=/usr/local/go
|
||||
export GOBIN=$GOROOT/bin
|
||||
export PATH=$PATH:$GOBIN
|
||||
export GOPATH=HOME/gopath
|
||||
```
|
||||
Starting from go 1.8,The GOPATH environment variable now has a default value if it is unset. It defaults to $HOME/go on Unix and %USERPROFILE%/go on Windows.
|
||||
### Homebrew
|
||||
|
||||
Homebrew is a software management tool commonly used in Mac to manage packages. Just type the following commands to install Go.
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
Go takes a unique approach to manage the code files with the introduction of a `$GOPATH` directory which contains all the go code in the machine. Note that this is different from the `$GOROOT` environment variable which states where go is installed on the machine. We have to define the $GOPATH variable before using the language, in *nix systems there is a file called `.bashrc` we need to append the below export statement to the file. The concept behind gopath is a novel one, where we can link to any go code at any instant of time without ambiguity.
|
||||
|
||||
Starting from go 1.8,The GOPATH environment variable now has a default value if it is unset. It defaults to $HOME/go on Unix and %USERPROFILE%/go on Windows.
|
||||
|
||||
In Unix-like systems, the variable should be used like this:
|
||||
|
||||
export GOPATH=/home/apple/mygo
|
||||
|
||||
Reference in New Issue
Block a user