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
cmd/gofmt: incorrect comment placement for a comment following a function #4381
Labels
Milestone
Comments
IIUC, "// foo" remains attached to the function just because is treated as a godoc comment. The convention is that comments precede the function definition, so I would not call the current behavior "incorrect". Since in this use case it is not really a godoc comment, I'd suggest considering a different convention for go present that does not interfere with the pre-existing godoc one. (E.g. "// START" and "// STOP" surrounded by blank lines.) Alternatively, if godoc is never to be used with go present source files, having different gofmt modes might be an option as well (distinguished via a command line option or some marker in the source). If the gofmt behavior is to be changed universally, it should be designed such that both of these are handled correctly, which does not seem straightforward to me: // START func f() { } // END // START func g() { } // END ... // Function f blahblahblah... // blahblahblah... func f() { } // Function g blahblahblah... // blahblahblah... func g() { } ... Just my two cents. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: