We probably need a community supported mirror for packages.
Simplest way that I can think of goes something like this.
in Gopkg.toml, add source as the community maintained mirror, like so
```
[[constraint]]
name = "github.com/user/package"
source = "example.com/github.com/user/package"
version = "1.0.0"
```
here example.com redirects to github.com/user/package
the first time, then caches in background and ensures all branches, commits and tags exist from that point on.
This still leaves two use cases:
What about repos that haven't been requested ever?
What if someone gets hold of the username and updates the code?
Also, how would we finance something this big?
评论:
pmrsaurus:
TheMerovius:Isn't the fix to simply
vendor/
your dependencies?
jmank88:in Gopkg.toml, add source as the community maintained mirror, like so
That assumes there is a Gopkg.toml.
I don't think that requiring upstream cooperation has any chance of resulting in a successful design.
FWIW, I made a proposal a while back to add transparent support for mirrors to go-get. The idea is to simply put a GOPATH on a webserver (so, e.g. serve https://foobar.com/github.com/user/repo) and then have go-get make a request to
instead of
/ https://
, if a flag is given.; IMO it would be pretty simple to implement that today edit as a separate tool[/edit] and it would solve a whole lot of issues that other people are trying to solve with dep/vendoring/whatever. It would just need someone to actually do it (and be willing to host mirrors).
freman:Related:
could just hack up a .gitconfig :D
[url "https://172.31.3.81:9992/https/github.com"] insteadOf = https://github.com
We're using it as a caching proxy but there's no reason you can'mt
[url "https://example.com/github.com/user/package"] insteadOf = https://github.com/user/package
