Skip to content

Instantly share code, notes, and snippets.

@stevekuznetsov
Created February 24, 2016 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevekuznetsov/cc943b1d7ba90979adf6 to your computer and use it in GitHub Desktop.
Save stevekuznetsov/cc943b1d7ba90979adf6 to your computer and use it in GitHub Desktop.
shadowing
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