modfile: replace empty comments when adding indirect
When we add an "indirect" token to a line with an empty comment (only
whitespace after //), we should replace the comment text.
In CL 208273, we inserted "indirect;". The isIndirect predicate returns
false for "// indirect;" because there's only one word. When
modload.WriteGoMod is called multiple times (as it is in
'go mod tidy'), this caused us to write "// indirect; indirect".
Run-TryBot: Jay Conrod <firstname.lastname@example.org>
TryBot-Result: Gobot Gobot <email@example.com>
Reviewed-by: Bryan C. Mills <firstname.lastname@example.org>
2 files changed