gosrc: Parsing file field of go-source meta tag does not implement spec fully. #385
Description
The documentation of go-source meta tag, https://github.com/golang/gddo/wiki/Source-Code-Links, states:
The file field is a URL template for a link to a line in a source file. The following substitutions are made in the file template:
{file} - The name of the file {line} - The decimal line number.
However, the actual implementation does not implement that behavior fully and correctly.
Instead, it makes a number of assumptions about what the file field URL template will look like, and fails to do what's expected given the spec above if any of the assumptions are not met.
Put simply, the file field URL template is expected to have {file}
in the first part, followed by a #
character, followed by optional single {line}
in the second part.
I've tried to document the exact consequences of the current implementation here:
It's not pretty, and it's not simple. 😧
When I tried to have a file field URL template that had both {file}
and {line}
come after the first #
, the file field was effectively ignored. /cc @slimsag
The file field URL template should be implemented as described in the spec and then the limitations section should be removed from the wiki.