Skip to content

Commit 9aea3b7

Browse files
committed
Format and remove en/01.2.md spaces
1 parent ab37b3f commit 9aea3b7

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

en/01.2.md

Lines changed: 22 additions & 22 deletions
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

0 commit comments

Comments
 (0)