-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
go/printer: CL 609077 causes unintended formatting changes #69382
Comments
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
cc @mateusz834 |
That is true that: type S struct {
//- comment
Name *string
} was formatted to this: type S struct {
// - comment
Name *string
} but, formatting: type S struct {
//- comment
Name *string
} formats it to this: type S struct {
//- comment
Name *string
} There is no change. Before CL 609077 the godoc formatting was performed for all comments, that start at the first Column of a line, this is wrong (e.g. for comments at the first column inside of a func declaration). I think that the fix is right. Maybe there should be a separate discussion to always start adding a space before a comment? |
Change https://go.dev/cl/612137 mentions this issue: |
CC @griesemer |
This reverts commit CL 609077. Reason for revert: it turned out to also introduce a change to the formatting as described in issue #69382, which wasn't intended. For #69382. Change-Id: Id8f36e5503e63e7586c8afe7c7d3dc25fd56ed94 Reviewed-on: https://go-review.googlesource.com/c/go/+/612137 Reviewed-by: Christian Höppner <hoeppi@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This change was reverted, without any further discussion here with a comment:
This formatting change was intended, see my comment above: #69382 (comment) and the test case, with a similar case (go doc formatting in not executed). go/src/go/printer/printer_test.go Lines 919 to 935 in 90391c2
Would like to hear how we should now move forward with this change. |
@mateusz834 Apologies for the revert w/o external discussion. W/o going details, this change broke some Google internal tests and in order to unblock this we decided to revert this change for now. The correct fix may well be that we need to make some changes to the internal code, but we haven't had the time to look into it. If we decide to do that, we may be able to simply reapply your CL. Thanks. |
go.dev/cl/609077 causes a change in formatting. Reading the CL description and the test cases leads me to believe that this change is unintended.
Reproducer:
Before go.dev/cl/609077, this printed:
After go.dev/cl/609077, this prints:
The text was updated successfully, but these errors were encountered: