Open 0xmohit opened 5 years ago
Btw, your What did you do?
section is wrong. The command is go mod edit -fmt
, not go mod tidy -fmt
as you have correctly mentioned in the title.
Btw, your
What did you do?
section is wrong. The command isgo mod edit -fmt
, notgo mod tidy -fmt
as you have correctly mentioned in the title.
It was a typo and was meant to be go mod edit -fmt
.
As it looks stale I'll investigate
Given the following go.mod
:
module exp
go 1.13
require (
// bar v0.0.0-00010101000000-000000000000
foo v0.0.0-00010101000000-000000000000
)
Should we leave it as it is instead of collapsing into single line?
module exp
go 1.13
// bar v0.0.0-00010101000000-000000000000
require foo v0.0.0-00010101000000-000000000000
I've created a CL to fix this: https://go-review.googlesource.com/c/mod/+/541815
Change https://go.dev/cl/545695 mentions this issue: modfile: do not collapse if there are unattached comments within blocks
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, happens with 1.12.6 too. Not tried with tip.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Executed
go mod edit -fmt
on the following. (The following is a minimal reproducible example of the actual go.mod file.)What did you expect to see?
Perhaps no change.
What did you see instead?
The commented disappeared after formatting.