Go learn the language from scratch [] four .Go commonly used commands Interpretation
A command interpretation .go hlep
If you have played the linux should have used this command to help, and we go in the terminal language also has some nice tools
Run the following command to go help go to find help on the command
go help
Is successful, displayed as follows
▶ go help
Go is a tool for managing Go source code.
Usage:
go <command> [arguments]
The commands are:
bug start a bug report
build compile packages and dependencies
clean remove object files and cached files
doc show documentation for package or symbol
env print Go environment information
fix update packages to use new APIs
fmt gofmt (reformat) package sources
generate generate Go files by processing source
get add dependencies to current module and install them
install compile and install packages and dependencies
list list packages or modules
mod module maintenance
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet report likely mistakes in packages
Use "go help <command>" for more information about a command.
Additional help topics:
buildmode build modes
c calling between Go and C
cache build and test caching
environment environment variables
filetype file types
go.mod the go.mod file
gopath GOPATH environment variable
gopath-get legacy GOPATH go get
goproxy module proxy protocol
importpath import path syntax
modules modules, module versions, and more
module-get module-aware go get
module-auth module authentication using go.sum
module-private module configuration for non-public modules
packages package lists and patterns
testflag testing flags
testfunc testing functions
Use "go help <topic>" for more information about that topic.
Here to explain it on the relevant commands:
1.1 go env command
go env command environment Print Go language
go env
Executed successfully, as shown below
1.2 go run instruction
go run the command used to compile the source code and run the command file, go to edit files with vim and if you want him to temporarily run up viewing, use this command: go run file_name
go run (记得加上你的go源码文件哦~)
Executed successfully, as shown below
1.3 go get command
go get command is used to download or update the specified code package and its dependencies from the Internet according to the requirements and the actual situation, and they build and install. When you need some third-party packages, such as web framework gin when the need to use this command to download, a similar pip python
go get
Executed successfully, as shown in FIG.
1.4 go build command
go build command is used to compile our source code file, or specify the code package as well as their dependencies.
go build (记得加上源码文件哦~)
Executed successfully, as shown below
after the execution command, which is generated in a directory Unix executable file, as shown in FIG.
1.5 go install command
go install command to compile and install the specified code packets and their dependencies. This command is installed by default in GOBIN variable, if it is empty, then installed in GOPATH, you can view a variable position by go env
go install
Executed successfully, as shown below
1.6 go clean command
Files go clean clean up all files, or add -i can install a clean installation by compiling: go clean command is used to delete some files and directories generated when performing other command, through the build files can be compiled directly
go clean
1.7 go test command
go test command to the Go programming language tests for ready-written package or program test: go test file_name
go test fmt
Executed successfully, as shown below
1.8 go list command
Go list command information packet for the specified code listed
go list
Executed successfully, as shown below