A leftpad fix?

agolangf · 2018-02-09 02:30:10 · 446 次点击    
这是一个分享于 2018-02-09 02:30:10 的资源,其中的信息可能已经有所发展或是发生改变。

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:

  1. What about repos that haven't been requested ever?

  2. What if someone gets hold of the username and updates the code?

Also, how would we finance something this big?


评论:

pmrsaurus:

Isn't the fix to simply vendor/ your dependencies?

TheMerovius:

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).

jmank88:

Related:

Start a conversation about ipfs/gx-style imports in dep

Support for private/enterprise patterns

freman:

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

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

446 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传