• 隐藏侧边栏
  • 展开分类目录
  • 关注微信公众号
  • 我的GitHub
  • QQ:1753970025
Chen Jiehua

Go包管理 

gpm

安装:

wget https://raw.githubusercontent.com/pote/gpm/v1.3.2/bin/gpm && chmod +x gpm

Godeps文件: gpm expects you to have a file called Godeps in the root of your Go application in the format <tag/revision>. 常用命令:

$ gpm            # Same as 'install'.
$ gpm get        # Parses the Godeps file, gets dependencies and sets them
                 # to the appropriate version but does not install them.
$ gpm install    # Parses the Godeps file, installs dependencies and sets
                 # them to the appropriate version.
$ gpm version    # Outputs version information
$ gpm help       # Prints this message

gopm

安装:

go get -u github.com/gpmgo/gopm

用法:

NAME:
   Gopm - Go Package Manager

USAGE:
   Gopm [global options] command [command options] [arguments...]

VERSION:
   0.8.6.1228 Beta

COMMANDS:
   list     list all dependencies of current project
   gen      generate a gopmfile for current Go project
   get      fetch remote package(s) and dependencies
   bin      download and link dependencies and build binary
   config   configurate gopm settings
   run      link dependencies and go run
   test     link dependencies and go test
   build    link dependencies and go build
   install  link dependencies and go install
   clean    clean all temporary files
   update   check and update gopm resources including itself
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --noterm, -n     disable color output
   --strict, -s     strict mode
   --debug, -d      debug mode
   --help, -h       show help
   --version, -v    print the version

文档: https://github.com/gpmgo/docs/blob/master/zh-CN/README.md gopm get 假设需要将依赖包全部下载到 $GOPATH 中,可以使用选项 --gopath, -g 来达到目的。如果希望保持您的 $GOPATH 整洁,而将它们全部下载到 gopm 本地仓库,则可以使用选项 --remote, -r 来达到目的。

gopm-bootstrap

安装:

$ git clone git@github.com:pote/gpm-bootstrap.git && cd gpm-bootstrap
$ ./configure
$ make install

用法:

$ gpm bootstrap           # Downloads all external top-level packages required by
                          # your application and generates a Godeps file with their
                          # latest tags or revisions.
$ gpm bootstrap version   # Prints version information for the plugin.
$ gpm bootstrap help      # Prints this message.

gpm VS gopm

gopm基于七牛云存储的用于提供版本化缓存和分发 Go 语言包服务的服务器。下载 Go 语言包从此告别低速 告别翻墙!但是它不支持私有GitLab!!! gpm比较简单,还有其他插件可用.gpm拉取gitlab上的包时默认为https,通过配置git将其改为ssh,不用输入gitlab用户名密码.

$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
insteadOf = https://github.com/
码字很辛苦,转载请注明来自ChenJiehua《Go包管理》

评论