go getthat uses Git subtrees. It is useful for producing repeatable builds and for making coordinated changes across multiple Go packages hosted on GitHub.
gost get, any packages that are hosted on GitHub will be sucked in as subrepositories and any other packages will be included in source form.
Unlike most vendoring mechanisms, gost is not meant to be used within a subfolder of an existing repo. Rather, to use gost, set up a new project (which we call a "gost repo") in order to do your vendoring in there.
A gost repo is a self-contained, versioned Go workspace, with its own src, pkg and bin folders. In fact, you can think of gost as nothing more than a way of versioning Go workspaces.
go get github.com/getlantern/gost
mkdir flashlight-build cd flashlight-build gost init
Note that you always have to specify the branch from which you're getting code.
gost get github.com/getlantern/flashlight master
At this point, we have a gost repo that incorporates flashlight and all of its dependencies (including test dependencies). We may want to go ahead and push upstream now.
git remote add origin https://github.com/getlantern/flashlight-build.git git push -u origin master
Now we make our changes.
git checkout -b mybranch master
gost get github.com/getlantern/newneededpackage master
gost get -u. It works just like
go get -uand updates the target package and dependencies.
gost get -u github.com/getlantern/flashlight
At this point, we can submit a pull request on GitHub, which will show all changes to all projects in our gost repo (i.e. our GOPATH). Once the PR has been merged to master, we can pull using git as usual.
git push --set-upstream origin mybranch
git checkout master git pull gost push -u github.com/getlantern/flashlight master
gost getwhich fetches dependencies,
gost pushonly pushes the specific package indicated in the command.
Note again that you have to specify the branch to which you want to push.
-uflag tells gost to first pull from upstream before pushing. You can omit it if you don't want to do this, but if you have upstream changes that aren't in your local repo, the push will fail.
You can also push to multiple repos in one step. For example, to push all packages in github.com/getlantern:
gost push github.com/getlantern master