-
Notifications
You must be signed in to change notification settings - Fork 1k
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
CLA signed |
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
Couple of notes on this.
|
bc0d5c4
to
2e3eb29
Compare
Projects building behind a corporate firewall need a way to deal with local projects - and, potentially, locally-cached versions of upstream projects. Such builds may exist behind a strict firewall; additionally, it's not always the case that the import path "example.com/xyz/bar" actually has the go vanity metadata being served from it. For these builds, we want a *local* way to intercept and redirect the actions of dep, to get it to fetch from alternative locations - *without* first attempting the HTTP(s) dereference of the importpath location. We do this by introducing a _registry_. The only functionality that this object must supply is that of the Deducer interface (which is now exported). The example code only has one kind of registry to resolve these import paths. It reads from the top-level file `Gopkg.reg, which should consist of lines containing whitespace-separated elements. These are: - the import path to match; this is a Golang regexp - the registry root corresponding to that import path. This may contain references to capture groups in the import path pattern. - one or more git URLs; these may also contain `$1`-style backreferences. Example content: ``` ^example\.com/xyz/([^/]*)(/.*)?$ example.com/xyz/$1 ssh://git@local-repo.org/foo/$1 ``` Imports of "example.com/xyz/bar" will be cloned from "local-repo.org/foo/bar". The current implementation is just a POC: its parsing of Gopkg.reg is rudimentary. It only supports git repositories. However, the principle is demonstrated: it requires minimal code-change to get the registry behaviour into dep. Registry implementations that talk to alternative repository APIs are, of course, possible. Note: the behaviour specified in Gopkg.reg is *not* inherited by any importing packages; it is a function solely of the local environment.
Dep was officially deprecated earlier this year, and the proposal to archive this repository was accepted. As such, I'm closing outstanding issues before archiving the repository. For any further comments, please use the proposal thread on the Go issue tracker. Thanks! |
What does this do / why do we need it?
This is an example of an approach to #174
Projects building behind a corporate firewall need a way to deal with local projects - and, potentially, locally-cached versions of upstream projects.
Such builds may exist behind a strict firewall; additionally, it's not always the case that the import path "example.com/xyz/bar" actually has the go vanity metadata being served from it.
For these builds, we want a local way to intercept and redirect the actions of dep, to get it to fetch from alternative locations - without first attempting the HTTP(s) dereference of the importpath location.
We do this by introducing a registry. The only functionality that this object must supply is that of the Deducer interface (which is now exported).
The example code only has one kind of registry to resolve these import paths. It reads from the top-level file `Gopkg.reg, which should consist of lines containing whitespace-separated elements. These are:
references to capture groups in the import path pattern.
$1
-style backreferences.Example content:
Imports of "example.com/xyz/bar" will be cloned from "local-repo.org/foo/bar".
The current implementation is just a POC: its parsing of Gopkg.reg is
rudimentary. It only supports git repositories. However, the principle
is demonstrated: it requires minimal code-change to get the registry
behaviour into dep. Registry implementations that talk to alternative
repository APIs are, of course, possible.
Note: the behaviour specified in Gopkg.reg is not inherited by any
importing packages; it is a function solely of the local environment.
What should your reviewer look out for in this PR?
Mostly, if this is a suitable approach; the code is just a quick sketch.
Do you need help or clarification on anything?
Which issue(s) does this PR fix?
(partially) fixes #174
NOTE:
README needs fixing prior to merge; you might or might not want to drop the Dockerfiles.