Let's explore the charm of GO language
Introduction
Go is an open source programming language that makes it easy to construct simple, reliable and efficient software.
Go was developed by Robert Griesemer, Rob Pike, Ken Thompson at the end of 2007, and later joined Ian Lance Taylor, Russ Cox, etc., and was finally open sourced in November 2009, and Go 1 stable was released earlier in 2012. Version. Now Go development is completely open and has an active community.
feature
- Simple, fast and safe
- Parallel, fun, open source
Memory management, array security, fast compilation
Environment setup
1. Download the installation package
1.1 You can visit
GO language Chinese website
download the installation package:1.2 If you can't download it, you can directly use the installation package I have downloaded (maybe the download is a bit slow):
1.3 Use the next installation method to install it. Note here that the address should be in the root directory as much as possible. I installed it in the root directory of Disk D:
2. Configure environment variables
Here I have configured all environment variables into user variables
2.1 Configure GOPATH and GOROOT
2.2 Configure Path
3. Verify the installation result
3.1 View version number
go version
3.2 View related configuration
go env
4. Change the domestic mirror
The initial settings are as follows:
4.1 First open the go module
go env -w GO111MODULE=on // Windows export GO111MODULE=on // macOS 或 Linux
4.2 Configure GOPROXY
Ali Cloud:
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/ // Windows export GOPROXY=https://mirrors.aliyun.com/goproxy/ // macOS 或 Linux
Qiniu Cloud:
go env -w GOPROXY=https://goproxy.cn // Windows export GOPROXY=https://goproxy.cn // macOS 或 Linux
4.3 Cancel the verification package
Go 1.13 sets the default GOSUMDB=sum.golang.org, which is used to verify the validity of the package. This URL may not be accessible due to the wall, so you can use the following command to close:
go env -w GOSUMDB=off // Windows export GOSUMDB=off // macOS 或 Linux
5. Have fun and start programming
5.1 Install VS code
Visit the official website to download the installation package for the corresponding platform:
5.2 Next installation method
Don't say anything
5.3 Install plugin
Just install two plug-ins here, one for Sinicization, one for GO, and one for running code
5.4 Get ready
Here you need to create three new folders, namely src, bin and pkg
Open the src folder with VS code and create a new file, here everyone is free:
5.5 Let's start writing hello world
Create a new first.go file
package main
import "fmt"
func main() {
fmt.Printf("hello world !!!")
}
Run it directly:
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。