build compile packages and dependencies
clean remove object files
doc show documentation for package or symbol
env print Go environment information
bug start a bug report
fix run go tool fix on packages
fmt run gofmt on package sources
generate generate Go files by processing source
get download and install packages and dependencies
install compile and install packages and dependencies
list list packages
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet run go tool vet on packages
go build
If the target has a main bag package, it will generate a binary file
If there is no main package, build instructions can only be used by the compiler to check whether, after compilation package will drop all temporary objects generated at compile time
The default scope is the current folder, you can also specify a directory compiled
...All matches
go build flysnow.org/tools/...All packages in the compilation tools directory
Generates a binary file in the current directory
Use the -o parameter to explicitly specify the path and file name
- raceOpen competition assay parameters
Cross-platform compilation
GOOS=linux GOARCH=amd64 go build packageName
go clean
Delete compiled files
go install
Steps to compile and install the file, which installed more than build a
Do not specify the default package for the installation of the current package
Installed or under bin pkg directory
Package file containing main (executable file) is mounted to the $GOPATH/bindirectory
Normal package file (file generation .a) mounted to the $GOPATH/pkg/$GOOS/directory
When there are multiple GOPATH directory, only the first valid directory
go run
Compile and execute programs that do not generate the file
File must contain the main function as a parameter
go get
Remote Access Code package and install
The source code is downloaded to $GOPATH/srcthe directory
-v display process
-u update with the network
-d Download only, do not install
go get automatically detect and install all dependencies
To get all the dependencies of a project, do not use git clone, go get used
# 下载所有依赖
go get -v ./...
go help
View built-in commands using the help
E.ggo help build
go env
No arguments is the viewing environment parameters