简体   繁体   English

在git上管理Go依赖

[英]Managing Go dependencies on git

I develop and maintain my Go project in the following directory: 我在以下目录中开发和维护我的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>

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? 我想知道是否有一种自动方式可以使用项目使用的版本而不是最新的提交来克隆所有依赖项?

You should look at Glide . 您应该看看Glide

Glide provides simplified Go project management, dependency management, and vendoring. Glide提供简化的Go项目管理,依赖项管理和供应商。

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. Glide基本上可以随时更改$ GOPATH,并将依赖项的副本保留在本地结构中,而不是标准Go环境惯用的全局结构中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM