英文:
Managing Go dependencies on git
问题
我在以下目录中开发和维护我的Go项目:
PROJECT_DIR=$GOPATH/src/github.com/<USERNAME>/<PROJECT_NAME>/main.go
PROJECT_DIR=$GOPATH/src/github.com/<USERNAME>/<PROJECT_NAME>/<APP-1>
PROJECT_DIR=$GOPATH/src/github.com/<USERNAME>/<PROJECT_NAME>/<APP-2>
但是这种方式只能跟踪我的项目的更改,无法跟踪依赖项及其版本。
我想知道是否有一种自动化的方式可以克隆所有依赖项,并使用与我的项目相同的版本,而不是最新的提交?
英文:
I develop and maintain my Go project in the following directory:
PROJECT_DIR=$GOPATH/src/github.com/<USERNAME>/<PROJECT_NAME>/main.go
PROJECT_DIR=$GOPATH/src/github.com/<USERNAME>/<PROJECT_NAME>/<APP-1>
PROJECT_DIR=$GOPATH/src/github.com/<USERNAME>/<PROJECT_NAME>/<APP-2>
But this way I can only track changes in my project and I cannot track dependencies and their versions.
I was wondering if there's an automated way of cloning all the dependencies using the version that my project is using and not the latest commit?
答案1
得分: 2
你应该查看Glide。
Glide提供了简化的Go项目管理、依赖管理和供应商管理。
Glide基本上会动态地改变你的$GOPATH,并将依赖项的副本保存在本地结构中,而不是传统的全局结构中,这是标准Go环境的惯例。
英文:
You should look at <a href="https://github.com/Masterminds/glide">Glide</a>.
Glide provides simplified Go project management, dependency management, and vendoring.
Glide basically changes your $GOPATH on the fly and keeps copies of your dependencies in a local structure instead of the global structure that is customary for a standard Go environment.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论