Go命令行工具

来源:互联网 发布:戴尔 r730 安装linux 编辑:程序博客网 时间:2024/05/02 01:40

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 packagesUse "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下生成可执行文件。

0 0