Allow to add custom metadata on repository, like go-import


#1

Go lang dependancies management use go-import metadata on repository. Eg:
curl -L -s golang.org/x/crypto | grep -i go-import <meta name="go-import" content="golang.org/x/crypto git https://go.googlesource.com/crypto">

It could be great to set custom metadata on repository


#2

I managed to support the go metadata with this extension:

https://phabricator.wikimedia.org/D776

But that required a customization to phabricator core which can be seen here: https://phabricator.wikimedia.org/D775

If upstream would accept the patch to core I’d love to ship it up stream. Or you could apply the patch yourself if you are running your own install of Phabricator.

@epriestley : any chance that upstream would accept this? It’s a fairly clean implementation but it adds an extension point to diffusion. It might be cleaner to add native go-get metadata support to core since it’s a fairly straightforward hack but it’s annoying that go-get requires this and supporting it sets a precedent that somehow might encourage more projects to add similar non-standard weirdness so I would understand a reluctance to support it at all.


#3

My gut is that if we implement this, we should either do something lower-level (e.g., go-import specific, like GitLFS) or higher-level (e.g., intercept and mangle any request).

Technically, you can sort of already do the latter by subclassing PhabricatorSite and creating a high-priority site which intercepts requests and steals them before PhabricatorPlatformSite, although this is more work and somewhat dangerous (if we fix bugs or make changes in PhabricatorPlatformSite, your Site would keep working the wrong way by default).

Also, given that we have a package management application, I’m not entirely sure this integration makes sense in Diffusion at all. Aligning on go get https://phabricator/package/crypto for package metadata probably makes more sense as a long-term direction than go get https://phabricator/source/crypto.