You can't declare the same variable twice in the same scope.
item := item
works only because it declares a new variable in the current scope, initialized with a variable with the same name (but different variable) from the outer scope.
Go distinguishes declarations from assignments. In this example, the second assignment is a no-op indeed.
You can't declare the same variable twice in the same scope.
works only because it declares a new variable in the current scope, initialized with a variable with the same name (but different variable) from the outer scope.Go distinguishes declarations from assignments. In this example, the second assignment is a no-op indeed.