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

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

cmd/gofmt: rewrite 'a->a' breaks declaration inside function literal #33105

rillig opened this issue Jul 14, 2019 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@rillig
Copy link
Contributor

rillig 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
Copy link
Contributor

Thanks for reporting this as well.

@dmitshur dmitshur added this to the Go1.14 milestone Jul 15, 2019
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 15, 2019
@gopherbot
Copy link

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

@gopherbot
Copy link

Change https://golang.org/cl/187917 mentions this issue: cmd/gofmt: don't turn nil slices into empty slices during rewriting

@golang golang locked and limited conversation to collaborators Sep 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants