Go language introductory tutorial: installation
Brother Yu writes Python. Learn Go and compare it with Python to gain a deeper understanding of Python.
Why learn to Go
I mainly use Python, not many other languages, and would like to learn a language to compare with Python. You might have a better understanding of Python.
The language had better be static and modern. Writing Python, you’ve heard the saying: Dynamic is great, refactoring the crematorium. Python is flexible, but very problematic at run time. New Python already has libraries like Pydantic for type checking, but I want to compare static languages.
Another uncomfortable aspect of writing Python is concurrency. Python concurrency is improving all the time, especially with coroutine usage, which is getting better every day, and many coroutine based libraries are too difficult to synchronize.
Let’s look at the use of Go and then Rust.
Which enterprises and projects are using Go
- Seven niuyun and other first-line Internet factories are useful
- Docker
- Kubernetes
- Beego is similar to Tonardo’s Web framework.
- Influxdb database
Advantages of Go
- Natural concurrent
- Universal language, you can do anything
- Especially good at big data, micro services, high concurrency
- Many big factories use them, but there is a shortage of talent
Environmental installation
Download the Go:
- Golang.org, domestic access problem.
- Go Language Chinese
Download the code editor:
- Vscode + GO plug-in (vscode download the go plug-in dependency will fail to install, need to manually configure, quite troublesome)
- Goland
- LiteIDE
Goland installation
Goland is jetBrain’s Go language integration environment. If used before the company’s products, it is quite handy, there is basically no threshold, open can be used.
But Goland charges a fee. Unlike Pycharm, IDEA is available in the community for free. There is no free version of Goland and you can try it for free for one month. You can find tutorials online for free.
Also contact me to pick up agent_latEST_2020.
LiteIDE installation
This is a Go integration environment developed by Chinese people, download on the official website: liteide.org/cn/. This integration environment isn’t as good as Goland, but it’s free!
Download, decompress, and run the software in the bin directory.
On the welcome page, you can directly click New to create a file or project, or open an existing directory.
After creating the project, the directory structure appears on the left:
Then write the Go code:
package main
import "fmt"
func main(a) {
fmt.Println("hello")
}
Copy the code
To compile or run code, you can click on the interface icon or run it from the terminal command line. To debug code, you can use FR.