Support go-source meta tag for godoc.org
Problem to solve
For many packages, godoc.org knows how to link to the source for documented definitions. For GitLab, it does not. GitLab has added support for the go-import
meta tag in ?go-get=1
requests. If GitLab added support for godoc.org's go-source
tag, godoc.org would be able to link to the source in GitLab.
Intended users
Go developers, both those who host their code on gitlab.com or another GitLab instance and those who use that code.
Further details
For example, my project: https://gitlab.com/aleph-project/form
And its documentation: https://godoc.org/gitlab.com/aleph-project/form
As compared to a package that has links to source: https://godoc.org/gopkg.in/yaml.v2
Proposal
In the handler for ?go-get=1
requests, output an additional go-source
meta tag. The requirements for this flag are documented here.
For example, here are the meta tags from https://gopkg.in/yaml.v2?go-get=1
<meta name="go-import" content="gopkg.in/yaml.v2 git https://gopkg.in/yaml.v2">
<meta name="go-source" content="gopkg.in/yaml.v2 _ https://github.com/go-yaml/yaml/tree/v2.2.2{/dir} https://github.com/go-yaml/yaml/blob/v2.2.2{/dir}/{file}#L{line}">
Permissions and Security
No changes to permissions are needed - the existing permissions for ?go-get=1
requests are sufficient. The only additional information exposed is GitLab's routing model (which is not secret).
Documentation
If GitLab has documentation for ?go-get=1
, then it would make sense to add to that.
Testing
This should not introduce any new risks.
What does success look like, and how can we measure that?
Documentation for public golang projects hosted on gitlab.com (and other public gitlab instances), such as my project, will have source links.