-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linefeed removed after multi line comments in composite literals #170
Labels
good first issue
Good for newcomers
Milestone
Comments
Thanks - this seems to be one of the cases where we forgot to check if there are any comments in those "empty" lines we're removing. If there are comments, we don't want to remove their newlines. Leaving as "good first issue" for a couple of days to see if someone wants to pick it up :) |
mvdan
added a commit
that referenced
this issue
Dec 4, 2021
For an input such as: var _ = map[string]string{ /* joint comment */ "foo": "bar", } We would incorrectly join the comment with the first element: var _ = map[string]string{ /* joint comment */ "foo": "bar", } Just like in other parts of the codebase, consider the first comment's position if it exists. Fixes #170.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Composite literals have blank lines removed, but it seems to treat the trailing
*/
of a multi-line comment as a blank line.If we add the following testcase to composite-literals-leading-lines
formatting produces:
This seems like an unintended consequence of f2d9f32
Also, this creates a conflict with gofmt v0.1.7 which wants (removed blank space):
The text was updated successfully, but these errors were encountered: