英文:
Golang tool for git pull?
问题
我正在尝试让不太懂技术的人能够将我的 Golang 程序作为命令行应用程序轻松使用。当我推送更改到 GitHub 上时,我希望他们也能轻松更新代码。是否有一种方式可以使用类似于 "go update github.com/user/repo" 的方式来更新库,这样他们就不必进入源代码目录并自行执行 git pull 命令了?或者在这一点上,我只能说 "是时候学习 Git 了"?
英文:
I'm trying to make it easy for the not-too-technical to use my golang program as a command line application. I want them to be able to update the code easily too when I push changes to github. Is there a way to update a library using something like "go update github.com/user/repo" so they don't have to cd to the src directory and git pull themselves? Or at this point must I simply say "time to learn git"?
答案1
得分: 4
你可以使用以下命令:
go get -u import/path
-u 标志指示 get 命令使用网络更新指定的包及其依赖项。默认情况下,get 命令会使用网络检出缺失的包,但不会使用网络查找现有包的更新。
英文:
You can use:
go get -u import/path
> The -u flag instructs get to use the network to update the named packages
and their dependencies. By default, get uses the network to check out
missing packages but does not use it to look for updates to existing packages.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论