Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: different behaviors between short and normal variable declarations #36449
What version of Go are you using (
It looks like this is because dcl.go:variter emits N:N variable declaration+initialization statements as
On the other hand, for
As @go101 points out, the discrepancy is still conforming to the Go spec, so it's not something we have to fix.
I suspect the easiest fix (assuming we think it's worth fixing) would be changing variter to emit a single OAS2 node instead of multiple OAS nodes. I'm a little nervous if this has any unintended consequences via
Another question is if it has any effect on compiler performance or on compiled program performance. I haven't looked into these at all yet.
I tried with a simple patch: