You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
Yes
Short variable declaration redeclares variable instead of using pre-existing variable
func main() {
a, b := 5, 6
if b == 6 {
a, c := 7, 8
if c == 5 {
return
}
}
fmt.Printf("%d", a)
}
variables a and b are declared using short variable declaration in the first statement. Then, after using short variable declaration to declare a, c within the body of the if statement, it reports that the variable a here is declared but not used.
Expected behavior is that the short variable declaration within the if body, should declare the new variable c and reference the already existing variable a.
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
Short variable declaration redeclares variable instead of using pre-existing variable
variables a and b are declared using short variable declaration in the first statement. Then, after using short variable declaration to declare a, c within the body of the if statement, it reports that the variable a here is declared but not used.
Expected behavior is that the short variable declaration within the if body, should declare the new variable c and reference the already existing variable a.
The text was updated successfully, but these errors were encountered: