Created
February 24, 2016 18:08
-
-
Save stevekuznetsov/cc943b1d7ba90979adf6 to your computer and use it in GitHub Desktop.
shadowing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
a, err := someFunc() | |
if err != nil { | |
return | |
} | |
if err := someOtherFunc(a); err != nil { // this `err` is not aliasing `err` in the outer scope | |
return | |
} | |
if b, err := someThirdFunc(a); err != nil { // this `err` *is* aliasing `err` in the outer scope | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment