-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: cmd/go: go list: report go-source tag information #59566
Comments
Anything I can do to move this forward? I assume it needs a decision from the |
This proposal has been added to the active column of the proposals project |
Talked to @bcmills and @matloob. We believe this is beyond the scope of the go command. The go-source line was defined by godoc.org before modules existed, and it provided a template to link to a specific line of a specific file in a go-get-able package. Later, the Go project adopted godoc.org and its code base but then we archived it once its replacement, pkg.go.dev, was ready. Nothing we have initiated or maintain today uses the go-source tags. In particular, neither the Go toolchain nor pkg.go.dev uses them. It seems like a mistake to add new support now, for at least two reasons:
Maybe it would make sense to define a replacement for go-source, but it is not a high priority, since not all module hosts may even have a web page view of every file in a module, and there is honestly limited value in being able to get to a web page about a given file. For the use case in the top comment, I don't understand how having a web page view for a given file in a module is going to help you derive "release-related metadata, such as the release notes, changelog, commit log, etc." The only way I can see that helping is if you recognize the go-source URL as being one of a set of known URLs, such as "this is GitHub" and then change the URL to find adjacent material. But if so, it seems like using the VCS Origin URL would work just as well. |
I agree that |
Based on the discussion above, this proposal seems like a likely decline. |
Thanks for the thoughtful response. I haven't had time to look at this in-depth, but planning to do so in the next few days, do you mind leaving the issue open through the end of this week? |
In the absence of new information the issue will be marked Declined on Wed 5/24. |
No change in consensus, so declined. |
go list
to return the content of the go-source
meta tag
Following up on this since it's still an issue we're facing in :
Yes, there's only a handful of popular source code hosts, so once we know a repo URL we have some generic code that extracts that metadata and adds it to the PR.
Unfortunately not. It's relatively common for the VCS Origin URL to be a vanity domain that's useful for Today, if opens a PR to bump If we only use the VCS Origin URL, we get pointed at https://go.googlesource.com/text, so we can't grab the release metadata unless we treat the custom domain We don't intend to dictate to library authors where to host their code--it doesn't have to be GitHub. But even in this example, that's a custom domain for the import... https://go.googlesource.com/text url isn't the actual source repo. According to https://pkg.go.dev/golang.org/x/text the source repo is actually https://cs.opensource.google/go/x/text, but there's no way for the library author to communicate that solely using the VCS Origin URL. As long as users have the ability to set custom/vanity domains for Your rationale for why the Again, all we really need here is a way for library authors who use a vanity import URL to say "here's the URL of the actual development repo". |
Sorry this took so long to circle back on... I moved off the team for a bit and only recently rejoined them, plus now on paternity leave so have time to circle back on some things I personally care about. Given that this has already been closed, and that the discussion is moving toward a generic side channel solution which may not be the |
https://go.googlesource.com/text is the upstream repo. |
@jeffwidman Yes, if you want to move this forward, a new proposal with a new approach would be the way to go. I think it's clear that we aren't going to change cmd/go for this. It might be more appropriate on pkg.go.dev. |
👋 over in we need to map a go module import path back to it's release-related metadata, such as the release notes, changelog, commit log, etc. We use this metadata when assembling the Dependabot PR.
Currently, we use a third-party library which is an older fork of some internal
go
code, but we'd much prefer to migrate to officialgo
tooling. More context.So I was delighted to notice that
go list
recently added support for mapping a module import path to the root repository URL.However, when I tried to migrate to that, I ran into problems because
go list go list -m -f '{{.Origin.URL}}' module@version
only lists thego-import
meta tag content, not thego-source
meta tag content as demonstrated in dependabot/dependabot-core#7045 (comment):After some digging, I'm unclear on the current
go
core team level of official support for thego-source
metadata tag. The primary docs for the format are on an archived repo, which doesn't inspire confidence: https://github.com/golang/gddo/wiki/Source-Code-LinksHowever, the proposal for an updated tag format was recently rejected: #39559
If the
go-source
tag remains a supported tag going forward, cango list
be enhanced to expose this metadata URL as well?I'm agnostic on the details of the solution--you folks know the
go list
API much better than I do, as long as there's a way to extract it I'd be happy.More notes:
Origin.SourceURL
field.Origin.URL
could be renamed toOrigin.ImportURL
for consistency with the existing meta tag names... unless this would be a backwards breaking change? Or is that API not considered fully stable yet?go-source
meta tag could be officially deprecated? However, it still seems like there's a valid use case for "download URL" vs "URL where the source code is developed, so users can see the history of PR's, commits, etc"...go-source
URL for newer versions of the library? From a perspective pragmatically we're fine with only showing whatever the latest value of the URL is, since at the time of the PR it'll generally be the latest package version available. But from a language design standpoint this corner case may need to be considered. 🤷♂️The text was updated successfully, but these errors were encountered: