Command - cruisechang/wiki-golang GitHub Wiki
go
- build compile packages and dependencies
- clean remove object files
- doc show documentation for package or symbol
- env print Go environment information
- 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
通用參數
- -n 只輸出命令,不執行
- -x 輸出正在執行的命令
- -v 輸出訊息
go get
- -u 更新 package
- -f 與-u配合,強制更新,無論是否過期
- -v
- -x
go clean
清理工作目錄,刪除編譯及安裝留下的文件
- -i 清理go install 安裝的文件
- -r 清理所有依賴package
- -x
- -n
go doc
顯示package或symbol的document
- -u
- -c Show documentation for unexported as well as exported symbols and methods.
go fix [packages]
Fix packages named by the import paths. See 'go help packages'
go generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages]
Generate go files by processing source.
預處理。在source裡插入預處理資訊,然後經由generate command 處理。
###go list
- go list -f '{{join .Deps "\n"}}' import-path
Show import dependencies for package at import-path,
or in current directory if is left empty.
- go list -f '{{join .DepsErrors "\n"}}' import-path
Shows some useful information.