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: rewrite 'a->a' adds parentheses around function return type #33104

rillig opened this issue Jul 14, 2019 · 2 comments


Copy link

commented Jul 14, 2019

What version of Go are you using?

go version go1.13beta1 windows/amd64

Does this issue reproduce with the latest release?


What did you do?

package main

func main() {
	_ = func() string {}
gofmt -r 'a->a' -d funcreturn.go

What did you expect to see?

The return type of the function literal is still string, without parentheses.

What did you see instead?

The return type is enclosed in parentheses.

-       _ = func() string {}
+       _ = func() (string) {}

This comment has been minimized.

Copy link

commented Jul 15, 2019

Thanks for reporting this.


This comment has been minimized.

Copy link

commented Jul 28, 2019

Change mentions this issue: cmd/gofmt: don't turn nil slices into empty slices during rewriting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.