This is a creation in Article, where the information may have evolved or changed.
The main features of the Go language
Automatic garbage collection richer built-in type functions multiple return value error handling anonymous function and closure type and interface concurrent programming reflection language interactivity high performance/efficient development
Installation
Installation Instructions Address
Package Download Address
Confirm that the installation is successful
Go version//view versions
environment variable Settings
Overall directory structure
With the package organization, only the package name, called Main, can contain the main function
One program has and only one main package
Importing other non-main packages with the Import keyword
bin/|-mathapppkg/|-platform name |-xxx.asrc/|-Mathapp |-main.go
Helloworld
The package main//declaration file Packageimport {"FMT"//import package, cannot contain unused packages, otherwise the compilation error}func main () {//Ingress function, no parameter no return value FMT. Println ("Hello World")}
Run the $go run Hello.go$go build Hello.go$./hello
Go command
Use the command line to view
Go helpgo build compile Go clean Remove compile build file from current source package Go FMT format code go get dynamic Get Remote code package go install Generate result file and compile results one to $gopath/pkg or $gopath/b Ingo Test run test executable file Go Doc godoc-http=:8080 view document go fix fix previous old version code to new release go version view current version Go ENV view current GO environment variable go list List all currently installed Packagego run to compile and run the Go Language program
Debugging
Debugging with GDB, the inside of the go language has built-in
Listbreakdeletebacktraceinfoprintwhatisnextcontinueset variable
Editor settings
Vim
Other supplements
Comments
Single-ROW/*-----*/Multiline
Import multiple Packages
Import ("FMT" "OS")
Calling the package in the ground function
<packageName>.<Function>