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' transforms 'default:' into 'case :' #33103
Comments
Thanks for the report. I checked, this affects Go 1.12.7 as well as Go 1.10.5, so it's not a new regression in Go 1.13 beta 1. Given this and the other 2 issues you reported (#33104, #33105), it seems there are some bugs in the rewrite rules when doing an identity replacement ( @rillig Have you seen this issue come up in more practical replace rules other than the no-op I checked https://goissues.org/cmd/gofmt and it doesn't seem that this was reported in the past, so thanks again. /cc @griesemer |
@dmitshur The reason I tried out the To make sure that gofmt doesn't damage my code, my idea was to first try the transformation by essentially doing nothing, before actually transforming something. So instead of running The simplest such call is |
Change https://golang.org/cl/187879 mentions this issue: |
Change https://golang.org/cl/187880 mentions this issue: |
Change https://golang.org/cl/187917 mentions this issue: |
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?
What did you expect to see?
After rewriting, the code still compiles.
What did you see instead?
The
default:
is rewritten tocase :
, which is syntactically invalid.This only happens inside a function literal, but not in main itself.
The text was updated successfully, but these errors were encountered: