Introduction to Go
Go (also known as Golang ) is a statically strongly typed, compiled language developed by Google's Robert Griesemer, Rob Pike and Ken Thompson. The Go language syntax is similar to C, but its functions include: memory safety, GC (garbage collection), structural form and CSP-style concurrent computing.
Features:
- Backed by major manufacturers, Google
- Support concurrency (the most significant feature)
- Simple syntax and easy to use
- Built-in runtime, supports garbage collection
- Can be compiled directly into machine code without relying on other libraries
- Rich standard library
- Cross-platform compilation
Application areas
- Server programming
- Development cloud platform
- Blockchain: Unique advantages, especially encryption algorithms
- Distributed Systems
- network programming
Install Go
Download address: https://golang.google.cn/dl/,
Download the installation package and install it directly.
Set environment variables
Configure the Go environment
go env
go env -w GO111MODULE="on"
go env -w GOPROXY="http://goproxy.cn"
//从powershell 用
$env:GO111MODULE = "on"
$env:GOPROXY = "http://goproxy.cn"
//使用 gomod 管理库,需要vpn上网,所有模组都再github上,需要有git
go get //类似 go clone
Go development tools
- sublime
- vim
- atom
- LiteIDE
- eclipse
- goland
- Use this for vscode , yyds!
VSCODE
- Direct installation
- Install plugin
1.GO
go run main.go encountered error go.mod file not found in the current directory or any parent directory;
Solution 1:
"The go command now builds packages in module-aware mode by default, even if no go.mod exists.
"You can set GO111MODULE to auto to enable module-aware mode only if a go.mod file exists in the current directory or any parent directory.
go env -w GO111MODULE=auto
2.Install Code Runner
Method 2:
god mod init go_1 //后面自己命名
The Buddha said that for people who are not destined to you, no matter how much you talk to them, it will be nonsense.
For people who are destined to you, your presence can awaken all their feelings.