Skip to content

Commit

Permalink
Format and remove en/01.2.md spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
vcaesar committed Jun 30, 2017
1 parent ab37b3f commit 9aea3b7
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions en/01.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ Execute following commands. ( ***Now author goes back to talk examples*** )
mkdir mymath

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

// Source code of $GOPATH/src/mymath/sqrt.go
package mymath

func Sqrt(x float64) float64 {
z := 0.0
for i := 0; i < 1000; i++ {
z -= (z*z - x) / (2 * x)
}
return z
func Sqrt(x float64) float64 {
z := 0.0
for i := 0; i < 1000; i++ {
z -= (z*z - x) / (2 * x)
}

return z
}
```
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.

## Compile packages
Expand Down Expand Up @@ -76,17 +76,17 @@ Write the following content to main.go.

```Go

//$GOPATH/src/mathapp/main.go source code.
package main
import (
"mymath"
"fmt"
)
func main() {
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
}
//$GOPATH/src/mathapp/main.go source code.
package main

import (
"mymath"
"fmt"
)

func main() {
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
}
```

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.
Expand Down Expand Up @@ -120,7 +120,7 @@ Actually, `go get` clones source code to the $GOPATH/src of the local file syste

You can use remote packages in the same way that we use local packages.
```Go
import "github.com/astaxie/beedb"
import "github.com/astaxie/beedb"
```
## Directory complete structure

Expand Down

0 comments on commit 9aea3b7

Please sign in to comment.