Golang工具用于git pull?

huangapple go评论75阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2014年8月12日 23:01:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/25267718.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定