Skip to content

Commit cdc2330

Browse files
authored
Merge pull request astaxie#855 from vCaesar/u17-pr
Update go install version and Remove zh/x.md spaces
2 parents 3fa6bd6 + f598371 commit cdc2330

36 files changed

+3185
-3187
lines changed

en/01.1.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ A 64-bit operating system will show the following:
7676

7777
### Mac
7878

79-
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.1.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.
79+
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.3.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.
8080

8181
### Linux
8282

83-
Go to the [download page](https://golang.org/dl/), choose `go1.8.1.linux-386.tar.gz` for 32-bit systems and `go1.8.1.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.1.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.
83+
Go to the [download page](https://golang.org/dl/), choose `go1.8.3.linux-386.tar.gz` for 32-bit systems and `go1.8.3.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.3.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.
8484

8585
### Windows
8686

87-
Go to the [download page](https://golang.org/dl/), choose `go1.8.1.windows-386.msi` for 32-bit systems and `go1.8.1.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.
87+
Go to the [download page](https://golang.org/dl/), choose `go1.8.3.windows-386.msi` for 32-bit systems and `go1.8.3.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.
8888

8989
## Use third-party tools
9090

@@ -96,8 +96,8 @@ GVM is a Go multi-version control tool developed by a third-party, like rvm for
9696

9797
Then we install Go using the following commands:
9898

99-
gvm install go1.8.1
100-
gvm use go1.8.1
99+
gvm install go1.8.3
100+
gvm use go1.8.3
101101

102102
After the process has finished, you're all set.
103103

@@ -112,8 +112,8 @@ Ubuntu is the most popular desktop release version of Linux. It uses `apt-get` t
112112
### wget
113113
```sh
114114

115-
wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
116-
sudo tar -xzf go1.8.1.linux-amd64.tar.gz -C /usr/local
115+
wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
116+
sudo tar -xzf go1.8.3.linux-amd64.tar.gz -C /usr/local
117117

118118
# Go environment
119119
export GOROOT=/usr/local/go

zh/01.1.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ Linux系统用户可通过在Terminal中执行命令`arch`(即`uname -m`)来查
7979

8080
### Mac 安装
8181

82-
访问[下载地址][downlink],32位系统下载go1.4.2.darwin-386-osx10.8.pkg(更新的版本已无32位下载),64位系统下载go1.8.1.darwin-amd64.pkg,双击下载文件,一路默认安装点击下一步,这个时候go已经安装到你的系统中,默认已经在PATH中增加了相应的`~/go/bin`,这个时候打开终端,输入`go`
82+
访问[下载地址][downlink],32位系统下载go1.4.2.darwin-386-osx10.8.pkg(更新的版本已无32位下载),64位系统下载go1.8.3.darwin-amd64.pkg,双击下载文件,一路默认安装点击下一步,这个时候go已经安装到你的系统中,默认已经在PATH中增加了相应的`~/go/bin`,这个时候打开终端,输入`go`
8383

8484
看到类似上面源码安装成功的图片说明已经安装成功
8585

8686
如果出现go的Usage信息,那么说明go已经安装成功了;如果出现该命令不存在,那么可以检查一下自己的PATH环境变中是否包含了go的安装目录。
8787

8888
### Linux 安装
8989

90-
访问[下载地址][downlink],32位系统下载go1.8.1.linux-386.tar.gz,64位系统下载go1.8.1.linux-amd64.tar.gz,
90+
访问[下载地址][downlink],32位系统下载go1.8.3.linux-386.tar.gz,64位系统下载go1.8.3.linux-amd64.tar.gz,
9191

9292
假定你想要安装Go的目录为 `$GO_INSTALL_DIR`,后面替换为相应的目录路径。
9393

94-
解压缩`tar.gz`包到安装目录下:`tar zxvf go1.8.1.linux-amd64.tar.gz -C $GO_INSTALL_DIR`
94+
解压缩`tar.gz`包到安装目录下:`tar zxvf go1.8.3.linux-amd64.tar.gz -C $GO_INSTALL_DIR`
9595

9696
设置PATH,`export PATH=$PATH:$GO_INSTALL_DIR/go/bin`
9797

@@ -120,33 +120,33 @@ Linux系统用户可通过在Terminal中执行命令`arch`(即`uname -m`)来查
120120
gvm是第三方开发的Go多版本管理工具,类似ruby里面的rvm工具。使用起来相当的方便,安装gvm使用如下命令:
121121
```sh
122122

123-
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
123+
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
124124
```
125125
安装完成后我们就可以安装go了:
126126
```sh
127127

128-
gvm install go1.8.1
129-
gvm use go1.8.1
128+
gvm install go1.8.3
129+
gvm use go1.8.3
130130
```
131131
也可以使用下面的命令,省去每次调用gvm use的麻烦:
132-
gvm use go1.8.1 --default
132+
gvm use go1.8.3 --default
133133

134134
执行完上面的命令之后GOPATH、GOROOT等环境变量会自动设置好,这样就可以直接使用了。
135135

136136
### apt-get
137137
Ubuntu是目前使用最多的Linux桌面系统,使用`apt-get`命令来管理软件包,我们可以通过下面的命令来安装Go,为了以后方便,应该把 `git` `mercurial` 也安装上:
138138
```sh
139139

140-
sudo apt-get install python-software-properties
141-
sudo add-apt-repository ppa:gophers/go
142-
sudo apt-get update
143-
sudo apt-get install golang-stable git-core mercurial
140+
sudo apt-get install python-software-properties
141+
sudo add-apt-repository ppa:gophers/go
142+
sudo apt-get update
143+
sudo apt-get install golang-stable git-core mercurial
144144
```
145145
### wget
146146
```sh
147147

148-
wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
149-
sudo tar -xzf go1.8.1.linux-amd64.tar.gz -C /usr/local
148+
wget https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
149+
sudo tar -xzf go1.8.3.linux-amd64.tar.gz -C /usr/local
150150
```
151151

152152
配置环境变量:
@@ -186,10 +186,10 @@ homebrew是Mac系统下面目前使用最多的管理软件的工具,目前已
186186

187187
```sh
188188

189-
brew update && brew upgrade
190-
brew install go
191-
brew install git
192-
brew install mercurial //可选安装
189+
brew update && brew upgrade
190+
brew install go
191+
brew install git
192+
brew install mercurial //可选安装
193193
```
194194

195195
## links

zh/01.2.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export GOPATH=/home/apple/mygo
1818

1919
Windows 设置如下,新建一个环境变量名称叫做GOPATH:
2020
```sh
21-
GOPATH=c:\mygo
21+
GOPATH=c:\mygo
2222
```
2323
GOPATH允许多个目录,当有多个目录时,请注意分隔符,多个目录的时候Windows是分号,Linux系统是冒号,当有多个GOPATH时,默认会将go get的内容放在第一个目录下。
2424

@@ -89,12 +89,12 @@ vim main.go
8989
package main
9090

9191
import (
92-
"mymath"
93-
"fmt"
92+
"mymath"
93+
"fmt"
9494
)
9595

9696
func main() {
97-
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
97+
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
9898
}
9999
```
100100

zh/01.4.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@
121121
适用于 Sublime Text 3:
122122

123123
```Go
124-
import urllib.request,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib.request.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
124+
import urllib.request,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();urllib.request.install_opener(urllib.request.build_opener(urllib.request.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib.request.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
125125
```
126126
适用于 Sublime Text 2:
127127

128128
```Go
129-
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp)ifnotos.path.exists(ipp)elseNone;urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read());print('Please restart Sublime Text to finish installation')
129+
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp)ifnotos.path.exists(ipp)elseNone;urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read());print('Please restart Sublime Text to finish installation')
130130
```
131131

132132
这个时候重启一下Sublime,可以发现在在菜单栏多了一个如下的栏目,说明Package Control已经安装成功了。
@@ -157,10 +157,10 @@
157157

158158
先在sublime安装gotests插件,再运行:
159159

160-
```Go
161-
go get -u -v github.com/cweill/gotests/...
162160

163-
```
161+
```Go
162+
go get -u -v github.com/cweill/gotests/...
163+
```
164164

165165
3. 验证是否安装成功,你可以打开Sublime,打开main.go,看看语法是不是高亮了,输入`import`是不是自动化提示了,`import "fmt"`之后,输入`fmt.`是不是自动化提示有函数了。
166166

@@ -220,33 +220,31 @@ vscode代码设置可用于Go扩展。这些都可以在用户的喜好来设置
220220

221221
接着安装依赖包支持(网络不稳定,请直接到Github[Golang](https://github.com/golang)下载再移动到相关目录):
222222
```Go
223-
go get -u -v github.com/nsf/gocode
224-
go get -u -v github.com/rogpeppe/godef
225-
go get -u -v github.com/zmb3/gogetdoc
226-
go get -u -v github.com/golang/lint/golint
227-
go get -u -v github.com/lukehoban/go-outline
228-
go get -u -v sourcegraph.com/sqs/goreturns
229-
go get -u -v golang.org/x/tools/cmd/gorename
230-
go get -u -v github.com/tpng/gopkgs
231-
go get -u -v github.com/newhook/go-symbols
232-
go get -u -v golang.org/x/tools/cmd/guru
233-
go get -u -v github.com/cweill/gotests/...
223+
go get -u -v github.com/nsf/gocode
224+
go get -u -v github.com/rogpeppe/godef
225+
go get -u -v github.com/zmb3/gogetdoc
226+
go get -u -v github.com/golang/lint/golint
227+
go get -u -v github.com/lukehoban/go-outline
228+
go get -u -v sourcegraph.com/sqs/goreturns
229+
go get -u -v golang.org/x/tools/cmd/gorename
230+
go get -u -v github.com/tpng/gopkgs
231+
go get -u -v github.com/newhook/go-symbols
232+
go get -u -v golang.org/x/tools/cmd/guru
233+
go get -u -v github.com/cweill/gotests/...
234234
```
235235

236236
vscode还有一项很强大的功能就是断点调试,结合[delve](https://github.com/derekparker/delve)可以很好的进行Go代码调试
237237

238238
```Go
239239

240-
go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
241-
242-
brew install go-delve/delve/delve(mac可选)
240+
go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
241+
242+
brew install go-delve/delve/delve(mac可选)
243243

244244
```
245245
如果有问题再来一遍:
246246
```Go
247-
248-
go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
249-
247+
go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
250248
```
251249
注意:修改"dlv-cert"证书, 选择"显示简介"->"信任"->"代码签名" 修改为: 始终信任
252250

@@ -285,13 +283,13 @@ Atom是Github基于Electron和web技术构建的开源编辑器, 是一款很漂
285283

286284
它需要依赖下面的go语言工具:
287285
```Go
288-
1.autocomplete-go :gocode的代码自动提示
289-
2.gofmt :使用goftm,goimports,goturns
290-
3.builder-go:go-install 和go-test,验证代码,给出建议
291-
4.gometalinet-linter:goline,vet,gotype的检查
292-
5.navigator-godef:godef
293-
6.tester-goo :go test
294-
7.gorename :rename
286+
1.autocomplete-go :gocode的代码自动提示
287+
2.gofmt :使用goftm,goimports,goturns
288+
3.builder-go:go-install 和go-test,验证代码,给出建议
289+
4.gometalinet-linter:goline,vet,gotype的检查
290+
5.navigator-godef:godef
291+
6.tester-goo :go test
292+
7.gorename :rename
295293

296294
```
297295
在Atom中的 Preference 中可以找到install菜单,输入 go-plus,然后点击安装(install)

zh/02.1.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
准备好了吗?Let's Go!
1010
```Go
1111

12-
package main
12+
package main
1313

14-
import "fmt"
14+
import "fmt"
1515

16-
func main() {
17-
fmt.Printf("Hello, world or 你好,世界 or καλημ ́ρα κóσμ or こんにちはせかい\n")
18-
}
16+
func main() {
17+
fmt.Printf("Hello, world or 你好,世界 or καλημ ́ρα κóσμ or こんにちはせかい\n")
18+
}
1919
```
2020
输出如下:
2121

0 commit comments

Comments
 (0)