cmd/gofmt: gofmt breaks examples with multline comments as output #43548
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
As per the guide "Testable examples in Go", I wrote a test file
example_test.go
inside an empty directory as the following:Run
go fmt
and thengo test
:What did you expect to see?
What did you see instead?
After running
go fmt
(see on playground) , the program becomes:The change of indentation of the line
A*
seems to make the test fail:Relevant issues & workarounds:
#41980
#5128 (comment)
#6416
The problem can be worked around by using inline comments (
//
), which don't depend on formatting. This runs ok before and after gofmt:However, this isn't satisfactory because it would make very difficult to check output longer that a couple of lines.
The text was updated successfully, but these errors were encountered: