Skip to content

Commit 041db8f

Browse files
authored
Merge pull request astaxie#819 from vCaesar/u11-pr
Fix some md error, Add en/0.1.x.md and 0.2.x.md syntax highlighting
2 parents dd4ebfd + 4322ae2 commit 041db8f

File tree

13 files changed

+1071
-1028
lines changed

13 files changed

+1071
-1028
lines changed

en/01.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Ubuntu is the most popular desktop release version of Linux. It uses `apt-get` t
109109
sudo apt-get update
110110
sudo apt-get install golang-stable
111111

112-
###wget
112+
### wget
113113
```sh
114114

115115
wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz

en/01.2.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Create a new application package called `mathapp`.
7474

7575
Write the following content to main.go.
7676

77+
```Go
78+
7779
//$GOPATH/src/mathapp/main.go source code.
7880
package main
7981

@@ -85,7 +87,8 @@ Write the following content to main.go.
8587
func main() {
8688
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
8789
}
88-
90+
```
91+
8992
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.
9093

9194
Hello world. Sqrt(2) = 1.414213562373095
@@ -116,9 +119,9 @@ After executing the above commands, the directory structure should look like fol
116119
Actually, `go get` clones source code to the $GOPATH/src of the local file system, then executes `go install`.
117120

118121
You can use remote packages in the same way that we use local packages.
119-
122+
```Go
120123
import "github.com/astaxie/beedb"
121-
124+
```
122125
## Directory complete structure
123126

124127
If you've followed all of the above steps, your directory structure should now look like the following.

en/01.4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ Atom is an awesome text editor released as open source cross platform, built on
468468
469469
Download: https://atom.io/
470470
471-
##Gogland
471+
## Gogland
472472
473473
Gogland is the codename for a new commercial IDE by JetBrains aimed at providing an ergonomic environment for Go development.
474474

en/02.1.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## What makes Go different from other languages?
22

33
The Go programming language was created with one goal in mind, to be able to build scalable web-applications for large scale audiences in a large team. So that is the reason they made the language as standardized as possible, hence the `gofmt` tool and the strict usage guidelines to the language was for the sake of not having two factions in the developer base, in other languages there are religious wars on where to keep the opening brace?
4+
```java
45

56
public static void main() {
67

@@ -11,6 +12,7 @@ The Go programming language was created with one goal in mind, to be able to bui
1112
{
1213

1314
}
15+
```
1416
or for python should we use 4 spaces or 6 spaces or a tab or two tabs and other user preferences.
1517

1618
While this might seem to be a shallow problem at the top, but when the codebase grows and more and more people are working on the same code base, then it is difficult to maintain the code's "beauty", if you know python then you might be aware of PEP8, which is a set of guidelines about how to write elegant code. We live in a world where robots can drive a car, so we shouldn't just write code, we should write elegant code.
@@ -40,15 +42,15 @@ Before we start building an application in Go, we need to learn how to write a s
4042
According to international practice, before you learn how to program in some languages, you will want to know how to write a program to print "Hello world".
4143

4244
Are you ready? Let's Go!
43-
45+
```Go
4446
package main
4547

4648
import "fmt"
4749

4850
func main() {
4951
fmt.Printf("Hello, world or 你好,世界 or καλημ ́ρα κóσμ or こんにちは世界\n")
5052
}
51-
53+
```
5254
It prints following information.
5355

5456
Hello, world or 你好,世界 or καλημ ́ρα κóσμ or こんにちは世界
@@ -83,10 +85,11 @@ Each go file is in some package, and that package should be a distinct folder in
8385
the thing here is that when your code is using some static files or something else, then you ought to run the binary from the root of the application as we see in the second line above, I am running the `main` binary *outside* the main package, sometimes you might wonder why your application isn't working then this might be one of the possible problems, please keep this in mind.
8486

8587
One thing you will notice here is that go doesn't see to use semi colons to end a statement, well, it does, just there is a minor catch, the programmer isn't expected to put semi colons, the compiler adds semi colons to the gocode when it compiles which is the reason that this (thankfully!) is a syntax error
86-
88+
```Go
8789
func main ()
8890
{
8991
}
92+
```
9093
because the compiler adds a semi colon at the end of `main()` which is a syntax error and as stated above, it helps avoid religious wars, i wish they combine `vim` and `emacs` and create a universal editor which'll help save some more wars! But for now we'll learn Go.
9194

9295
## Conclusion

0 commit comments

Comments
 (0)