1. Go commands:
Godoc-http: 8080 // obtain the official website documentation locally
Go get // obtain the remote resource package
Go run // run the program directly
Go build // test compilation and check for any compilation errors
Go install // compile the package file and compile the entire program
2. Go environment variables and working directory
* Bin: stores the executable files generated after compilation.
* PKG: stores the compiled package files.
* SRC: stores the project source code.
3. Go environment variables:
Set goarch = amd64 // CPU architecture
Set Gobin = // bin folder in the working directory
Set gocache = c: \ Users \ xcxz \ appdata \ Local \ go-build
Set goexecmd.exe // generate the suffix of the executable file
Set goflags =
Set gohostarch = amd64 // cross-compiled Architecture
Set gohostos = Windows // cross-compiled System
Set GOOS = Windows
Set gopath = c: \ Users \ xcxz \ go // working directory
Set goproxy =
Set gw.e =
Set goroot = D: \ go // installation directory
Set gotmpdir =
4. The first go program: Hello World
(1) Create the file hello. Go in the Directory D: \ go \ SRC.
Package mainimport"FMT"Func main () {FMT. println ("Hello world, world!")}
(2) Run: D: \ go \ SRC> go run Hello. Go in cmd.
Go programming Basics