Skip to content

Commit 483889c

Browse files
authored
Merge pull request astaxie#861 from vCaesar/u19-pr
Optimize typography and Format and remove en/01.x.md spaces
2 parents 33e39a0 + c772f3e commit 483889c

14 files changed

+431
-421
lines changed

en/01.2.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ Execute following commands. ( ***Now author goes back to talk examples*** )
3434
mkdir mymath
3535

3636
Create a new file called `sqrt.go`, type the following content to your file.
37+
```Go
38+
// Source code of $GOPATH/src/mymath/sqrt.go
39+
package mymath
3740

38-
// Source code of $GOPATH/src/mymath/sqrt.go
39-
package mymath
40-
41-
func Sqrt(x float64) float64 {
42-
z := 0.0
43-
for i := 0; i < 1000; i++ {
44-
z -= (z*z - x) / (2 * x)
45-
}
46-
return z
41+
func Sqrt(x float64) float64 {
42+
z := 0.0
43+
for i := 0; i < 1000; i++ {
44+
z -= (z*z - x) / (2 * x)
4745
}
48-
46+
return z
47+
}
48+
```
4949
Now my package directory has been created and it's code has been written. I recommend that you use the same name for your packages as their corresponding directories, and that the directories contain all of the package source files.
5050

5151
## Compile packages
@@ -76,17 +76,17 @@ Write the following content to main.go.
7676

7777
```Go
7878

79-
//$GOPATH/src/mathapp/main.go source code.
80-
package main
81-
82-
import (
83-
"mymath"
84-
"fmt"
85-
)
86-
87-
func main() {
88-
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
89-
}
79+
//$GOPATH/src/mathapp/main.go source code.
80+
package main
81+
82+
import (
83+
"mymath"
84+
"fmt"
85+
)
86+
87+
func main() {
88+
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
89+
}
9090
```
9191

9292
To compile this application, you need to switch to the application directory, which in this case is `$GOPATH/src/mathapp`, then execute the `go install` command. Now you should see an executable file called `mathapp` was generated in the directory `$GOPATH/bin/`. To run this program, use the `./mathapp` command. You should see the following content in your terminal.
@@ -120,7 +120,7 @@ Actually, `go get` clones source code to the $GOPATH/src of the local file syste
120120

121121
You can use remote packages in the same way that we use local packages.
122122
```Go
123-
import "github.com/astaxie/beedb"
123+
import "github.com/astaxie/beedb"
124124
```
125125
## Directory complete structure
126126

en/01.4.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ First, download the version of [Sublime](http://www.sublimetext.com/) suitable f
115115
Applicable to Sublime Text 3:
116116

117117
```Go
118-
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())
118+
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())
119119
```
120120
Applicable to Sublime Text 2:
121121

122122
```Go
123-
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')
123+
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')
124124
```
125125
126126
Restart Sublime Text when the installation has finished. You should then find a `Package Control` option in the "Preferences" menu.

0 commit comments

Comments
 (0)