Skip to content
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: removes parens around empty return values #8022

Closed
dvyukov opened this issue May 18, 2014 · 6 comments
Closed

cmd/gofmt: removes parens around empty return values #8022

dvyukov opened this issue May 18, 2014 · 6 comments

Comments

@dvyukov
Copy link
Member

@dvyukov dvyukov commented May 18, 2014

go version devel +386c6757d94c Sat May 17 00:06:56 2014 +0000 + darwin/amd64

Program is:
http://play.golang.org/p/ug90sObziw

gofmt changes source code as s/main() ()/main()/
This could be an option with -s, but w/o -s I would expect it to not change program text.
@dvyukov
Copy link
Member Author

@dvyukov dvyukov commented May 18, 2014

Comment 1:

A similar case is:
func foo() (int) {
    return 0
}
transformed to:
func foo() int {
@cznic
Copy link
Contributor

@cznic cznic commented May 18, 2014

Comment 2:

I'd say that both changes are what I expect gofmt is for.
@MichaelTJones
Copy link
Contributor

@MichaelTJones MichaelTJones commented May 18, 2014

Comment 3:

seems that ((x)) => (x) in any case, though in expressions (a*b)/c can't be touched.
@dominikh
Copy link
Member

@dominikh dominikh commented May 18, 2014

Comment 4:

Just my two cents: I've been depending and making use of that behaviour for at least a
year now. In my opinion, this isn't really just a plain simplification, the input is
very much wrongly formatted Go.
@dvyukov
Copy link
Member Author

@dvyukov dvyukov commented May 20, 2014

Comment 5:

Labels changed: added repo-main.

@rsc
Copy link
Contributor

@rsc rsc commented May 21, 2014

Comment 6:

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.