How to work with a development vendor package managed by dep?

折月煮酒 提交于 2019-12-04 15:40:13

According to the dep docs, there is no inbuilt way of doing this as it stands.

They also recommend not modifying packages in the vendor directory directly, for the reasons I discovered: it gets nuked when running dep ensure.

Their main suggestion is to manually remove the package from the vendor/ directory, modify it in the regular $GOPATH, and running dep ensure -update <pkg> when finished development of it.

This is sufficiently better than pushing for each change, but still requires to manually push/dep ensure when completing the development work.

An alternative to "ignoring .git" is to keep the .git folder elsewhere! (well outside of your Go project)

Any time you need to execute a git command in the vendored sub-project, you would need to use an alias to the git command, which would be:

alias gg='git --git-dir=/path/to/elsewhere/.git --work-tree=/path/to/vendored/subproject'
# Windows
doskey gg=git --git-dir=C:\path\to\elsewhere\.git --work-tree=C:\path\to\vendored\subproject $*

That way, you can still benefit from version-controled operations within your vendored subproject.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!