go <command> [args]
命令:
bug:开始bug报告 | build:编译package 和dependency
clean: 移除object文件和cache | doc:展示go文档
env: 打印go环境信息 | fix:更新package信息
fmt: 格式化gopackage | generate: 生成与变异
install: 安装和编译dependecy和package | list : 显示package和module
mod: module维护 | run: 编译和运行go文件
test: 测试package
go build [-o output] [-i] [build flags] [packages]
flag :
-a force rebuilding of packages that are already up-to-date. -n print the commands but do not run them. -p n the number of programs, such as build commands or test binaries, that can be run in parallel. The default is the number of CPUs available. -race enable data race detection. Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64. -msan enable interoperation with memory sanitizer. Supported only on linux/amd64, linux/arm64 and only with Clang/LLVM as the host C compiler. -v print the names of packages as they are compiled. -work print the name of the temporary work directory and do not delete it when exiting. -x print the commands. -asmflags '[pattern=]arg list' arguments to pass on each go tool asm invocation. -buildmode mode build mode to use. See 'go help buildmode' for more. -compiler name name of compiler to use, as in runtime.Compiler (gccgo or gc). -gccgoflags '[pattern=]arg list' arguments to pass on each gccgo compiler/linker invocation. -gcflags '[pattern=]arg list' arguments to pass on each go tool compile invocation. -installsuffix suffix a suffix to use in the name of the package installation directory, in order to keep output separate from default builds. If using the -race flag, the install suffix is automatically set to race or, if set explicitly, has _race appended to it. Likewise for the -msan flag. Using a -buildmode option that requires non-default compile flags has a similar effect. -ldflags '[pattern=]arg list' arguments to pass on each go tool link invocation. -linkshared link against shared libraries previously created with -buildmode=shared. -mod mode module download mode to use: readonly or vendor. See 'go help modules' for more. -pkgdir dir install and load all packages from dir instead of the usual locations. For example, when building with a non-standard configuration, use -pkgdir to keep generated packages in a separate location. -tags 'tag list' a space-separated list of build tags to consider satisfied during the build. For more information about build tags, see the description of build constraints in the documentation for the go/build package. -toolexec 'cmd args' a program to use to invoke toolchain programs like vet and asm. For example, instead of running asm, the go command will run 'cmd args /path/to/asm <arguments for asm>'.
go clean [clean flags] [build flags] [packages]
go doc <pkg> go doc <sym>[.<methodOrField>] go doc [<pkg>.]<sym>[.<methodOrField>] go doc [<pkg>.][<sym>.]<methodOrField>
go get [-d] [-f] [-t] [-u] [-v] [-fix] [-insecure] [build flags] [packages]
go install [-i] [build flags] [packages]
go list [-f format] [-json] [-m] [list flags] [build flags] [packages]
go mod <command> [arguments]
download download modules to local cache
edit edit go.mod from tools or scripts
graph print module requirement graph init initialize new module in current directory tidy add missing and remove unused modules vendor make vendored copy of dependencies verify verify dependencies have expected content why explain why packages or modules are needed
go run [build flags] [-exec xprog] package [arguments...]
go test [build/test flags] [packages] [build/test flags & test binary flags]
浙公网安备 33010602011771号