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: one-method interfaces should be able to be on one line #21952
Comments
This would be a backwards compatible change, and personally I'd be happy to see this happen. But gofmt's formatting is pretty stable nowadays, so perhaps not. |
Another issue: notice how the output changes again if format is clicked a second time. |
I hate to complain about gofmt but this is the one thing that bugs me about it. It comes up for me whenever I'm doing type assertions to another interface. I want to write
The workaround isn't hard, but I end up with code like
which adds more steps to reading the line than I feel should be necessary for a common operation. |
@bontibon Thanks for pointing that out. I think it's definitely a bug if cmd/gofmt is non-idempotent. |
Change https://golang.org/cl/66130 mentions this issue: |
Like structs.
What did you do?
What did you expect to see?
Formatting doesn't change anything.
What did you see instead?
Formatting changes the non-empty interface to span multiple lines.
System details
The text was updated successfully, but these errors were encountered: