-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: module proxy protocol, extending the information endpoint #41902
Comments
I think we'd need a strong reason to consider adding more information. Also, many of the things you've asked for, like import path and documentation, are more about packages than modules. There's no guarantee that there is a package at the root of a module. Even licenses are something that pkg.go.dev shows per-package rather than per-module. As for requires, downloading and parsing the go.mod shouldn't be that much of a burden? And that gives you the module name, which is essentially the import path you asked for. |
In my opinion, that maybe strong reason would be offering consistent metadata for modules and packages in universally readable format, allowing an easier interoperation with other package managers and analysis tools. Maybe not to the point of crates.io, but at least with enough information to build dependency graphs. I've updated the proposal in order to remove references to packages and talk only about modules as, effectively, there were some misconceptions in the original issue.
That's my last resort, though manually parsing sui generis formats from another programming language might not be the cleanest solution. |
@heschik, I've solved my use case with a mix of regular expressions and proper selectors for extracting licenses and documentation from pkg.go.dev. 😅 Nevertheless, I've updated my proposal again to reflect a realistic package and module structure, including useful fields for external dependency managers. For a bit of background, this proposal originated during a tentative refactoring of the Guix Feel free to close the issue if you deem it unproductive, though it would be no surprise finding a new use case for this functionality in a near future. Thank you for your valuable advice! |
💯 @hyangah, certainly, there is some overlap between the official module proxy and the official package/module discovery service, and #36785 is really apropos. Thank you! If pkg.go.dev implements the proposed enhancement along with a dedicated code endpoint like Do you think that proxying/caching useful metadata along with the code would be a good idea? |
CC @bcmills, @jayconrod, @matloob per owners. |
The main reason One reason we're hesitant to extend the About the specific fields you asked for:
|
That's a nice feature. In fact, I'm using it in order to resolve commit hashes and tags and get long versions for some modules.
That's a very interesting point: we can't obviate the importance of having integrity information for every module and its metadata, though relying on custom formats like Though it would be feasible to verify every package on the server and sign the JSON responses with JWS or similar methods, that would add server-side overhead and require a trusted proxy, directory or discovery service. The only long-term solution I see for this issue would probably involve replacing both
I'm getting it from pkg.go.dev, but web scraping might not be the most elegant solution.
That's a really delicate issue, and the less friction path would probably be serving this information through pkg.go.dev by exposing a public API, as that site is already serving extracted license names in a nearly-SPDX format.
The issue is that
I'll use it for now, thanks! |
Closing this issue in favor of #36785, which seems like the best way to move forward in the long term. I don't think implementing |
Completely agree, @jayconrod. Thanks! |
Module proxy protocol: extending the information endpoint
Given that proxy.golang.org serves as some sort of central registry for modules, it would be great if it could provide additional information in an universally readable format through the information endpoint:
These fields may be or may be not be part of the base proxy specification, but it would be nice to have them at least on the official implementation.
Proposed additional response fields:
Documentation: a short sentence describing the module purpose, can be extracted in the same way as
go list -json
.Licenses: the same license strings shown in pkg.go.dev, or
[]
for unknown licenses; ideally including the github.com/google/licensecheck to SPDX conversion used here.Dependencies: a list with the same fields as
requires
in thego.mod
file, including the// indirect
comment as an additional field.Hashes: for both the package and every requirement, as per the
go.sum
format.Additional fields: every field as produced by
go mod edit -json
.What did you do?
What did you expect to see?
What did you see instead?
Omitted fields:
I've omitted the following fields because they don't seem to be useful for this proposal:
The text was updated successfully, but these errors were encountered: