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' breaks declaration inside function literal #33105

Open
rillig opened this issue Jul 14, 2019 · 3 comments

Comments

@rillig
Copy link
Contributor

commented Jul 14, 2019

What version of Go are you using (go version)?

go version go1.13beta1 windows/amd64

Does this issue reproduce with the latest release?

yes

What did you do?

package main

func main() {
	_ = func() { var ptr *string; println(ptr) }
}
gofmt -r 'a->a' -d rewrite.go

What did you expect to see?

No change.

What did you see instead?

-       _ = func() { var ptr *string; println(ptr) }
+       _ = func() { var ptr *string = ; println(ptr) }
@dmitshur

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

Thanks for reporting this as well.

@dmitshur dmitshur added this to the Go1.14 milestone Jul 15, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Jul 27, 2019

Change https://golang.org/cl/187877 mentions this issue: cmd/gofmt: fix a->a rewrite rule

@gopherbot

This comment has been minimized.

Copy link

commented Jul 28, 2019

Change https://golang.org/cl/187917 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
Projects
None yet
3 participants
You can’t perform that action at this time.