I have 2 variables with similar names in two different functions and inside of them I get variable's address using &.
Question is: is it possible that it will get a memory address of a variable inside the second function
I have 2 variables with similar names in two different functions and inside of them I get variable's address using &.
Question is: is it possible that it will get a memory address of a variable inside the second function
If those functions do not call each other, it's possible that calling one, the address will be x, then if the function returns (and the variable does not escape) and the other function is called, the same x address may be reused; but only if the other variable is not live (reachable) anymore. Whether this may be the case is not clear from your question.
Go has automatic memory management. Unless you touch package unsafe, you should not worry about pointers and addresses, it's safe to take and even to return addresses of local variables. The same memory will not be reused if a variable using that memory is still reachable.
One exception is variables that have 0 size. As per the spec, variables having zero size may or may not have the same address. In practice this causes no trouble as you can't change the value of such variables as they cannot store different values, but you can't assume anything about their memory addresses.