Relax acceptable XS-Go-Import-Path syntax - #305
Conversation
cf5f502 to
ef5dd77
Compare
60ecc55 to
e5b8257
Compare
e5b8257 to
605982a
Compare
This should have been part of commit 9f00e05 but I forgot that `With*` is the idiomatic way to name functions that return options.
Explicitly allow maintainers to add a trailing comma for VC-friendly
multiline values:
XS-Go-Import-Path:
example.com/foo,
example.com/bar,
Currently all code that consumes the map returned from
`getGolangBinaries` ignores the empty string entry, so this commit
should not change behavior at all. However, this commit improves
readability by making it easy to see what happens in this corner case;
developers don't need to look at every caller of `getGolangBinaries`
to see how the empty string entry is handled. It is also defensive;
it avoids surprises for any future consumers of `getGolangBinaries`.
For example:
XS-Go-Import-Path:
example.com/foo
example.com/bar
This avoids forcing package maintainers to look up whether a trailing
comma after the final item is allowed or not. (Separating by
whitespace or permitting a trailing comma makes it easier to construct
a readable and VC-friendly multiline list of values.) Spaces cannot
exist in a module path, so there is no risk of parsing ambiguity.
The `make` subcommand doesn't produce space-separated lists, and
`dh-golang` doesn't yet support it, so this is just a step towards
generally allowing it everywhere.
605982a to
180330a
Compare
|
Do we really need the field to support both using commas or space as separator? In |
Do you mean a mix of space- and comma-separated items within a single If that's what you mean, then no, we don't need to support that. But:
|
|
In practise, I've only seen them comma-separated. I'm pretty sure that's how the ftp-master API parses them. |
|
While I think I might have preferred to have this field be separated by spaces instead of commas, this seems too late now to switch, and not worth the potential fallout. A brief check on dak, seems to imply it does not care about the shape of the field's value. I also stumbled over this recently when making dh-golang more robust when parsing this field, and ended up making sure spaces are not considered separators, but final commas are accepted. I don't know what else might be parsing this field, either. |
This PR relaxes how
XS-Go-Import-Pathvalues are parsed to improve maintainer friendliness:XS-Go-Import-Path(in particular, ignore a trailing comma).