ubuntu安裝配置好go環境後,終端執行”go”則會顯示出一些常用命令。其中有一些是在編譯安裝信令服務器時使用到的。
執行“go”後,
Usage:
go command [arguments]
The commands are:
build compile packages and dependencies
clean remove object files
env print Go environment information
fix run go tool fix on packages
fmt run gofmt on package sources
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
Use "go help [command]" for more information about a command.
Additional help topics:
c calling between Go and C
gopath GOPATH environment variable
importpath import path syntax
packages description of package lists
testflag description of testing flags
testfunc description of testing functions
go build:編譯包和依賴項。
如果是main包,默認編譯執行命令時所在目錄的所有包,生成可執行文件。也可指定要編譯的文件,在命令後加上文件即可。
go get :下載並安裝包和依賴。分爲兩步,下載所需的依賴包,編譯並安裝。下載依賴源碼下載工具。在go get之前,必須安裝必要的下載工具,更詳細介紹可見http://www.jb51.net/article/56781.htm
go install:編譯並且安裝包和依賴。分兩步,編譯生成結果文件,將結果文件移到GOPATH/pkg或者GOPATH/binmulu xia .
go doc pkgname:可以用來查看pkgname手冊。嘗試了下,在ubuntu14.04上面,go1.5.1情況下,執行apt-get install golang-go.tools即可安裝go doc工具。
apprtc的信令服務器collider編譯安裝的步驟爲
go get collidermain 作用是下載依賴項
go install collidermain 作用是編譯和安裝,最後在GOPATH/bin下生成可執行文件。