O'Reilly logo
  • Jose E Colon Rodriguez thinks this is interesting:

Since neither cwd nor err is already declared in the init function’s block, the := statement declares both of them as local variables. The inner declaration of cwd makes the outer one inaccessible, so the statement does not update the package-level cwd variable as intended

From

Cover of The Go Programming Language

Note

Pitfall when using := and variables in different scopes.