First, Installation:
1. Download Go address: https://golang.org/dl/
Click Install package to install (Linux direct decompression)
Setting environment variables (Linux)
1. Export goroot= $PATH:/path/to/go/
2. Export path= $PATH: $GOROOT/bin/
3. Export Gopath=/home/user/project/go
Setting Environment variables (window does not have to be set
2. IDE selection (Visual Studio Code)
Download Address: https://code.visualstudio.com/
View > Expand > Find go> Installation
3, the installation of debugging tools
Tutorial: Https://github.com/derekparker/delve/tree/master/Documentation/installation
Enter go get github.com/derekparker/delve/cmd/dlv in Win:cmd
4. Catalogue
5. Environment variable Setting
Set Environment variables: (create) Use G:\project>go build-o bin/list.exe Go_dev/day2/example1/main to create Applications-O is the application created in the bin
6, the first program
Package main //define the packet name import ("FMT"//reference FMT package, the FMT package implements the format IO (input/output) function) Func main () {
/* Long paragraph comment */fmt. Println ("Hello World")//content to be printed}
7. Print a program from 1 to 100
Goroute.go
Package Mainimport ("FMT") func test_goroute (a int) {FMT. Println (A)}
Main.go
Package Mainimport ("Time") Func main () {for i: = 0; i<100; i++{go test_goroute (i)}time. Sleep (time. Second)}