GoLand uses Go
1. Installation
- Visit the official website
https://golang.google.cn/
2) Click Download Go and select the package for the corresponding platform.
If you are using a Mac here, choose Apple macOS.
3) Double click to install directly
4) Verify that the installation is complete
Input go version
output corresponding version, the installation is completed
➜ ~ go version
go version go1.13.1 darwin/amd64
2. Use
- Recommend to use GoLand
Official website download address:
http://www.jetbrains.com/go/
- Choose
Go Modules(vgo)
to create to project.
3) Create hello.go file
Enter the code:
Note the first line, the package name must be
main
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello World!")
}
3. Run
Compile: Generate executable file
go build hello.go
Cleanup: Delete the executable file generated by compilation
go clean hello.go
Run: run the code
go run hello.go