cmd/gofmt: -r 'bar(x) -> bar(x)' mistakenly replaces a comment with a newline in closures inside function #23275
Labels
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?go version go1.9.2 linux/amd64
What did you do?
$ gofmt -r 'bar(x) -> bar(x)' /tmp/test.go
/tmp/test.go is:
What did you expect to see?
Same contents
What did you see instead?
Notice the comment in the closure passed to bar was replaced with an empty line, and an empty line was added after the call to bar.
The identity rewrite rule is for simplicity, this happens with more useful rewrites that act on bar too.
The text was updated successfully, but these errors were encountered: