Re: [go-nuts] Weird behavior of a nil check after variable redeclaration

2017-12-22 Thread Jan Mercl
Putting anything that has a type in any interface makes it non nil. (*foo)(nil) has a type. On Fri, Dec 22, 2017, 17:38 Vincent Rischmann wrote: > Hello, > > while refactoring some code I encountered something strange regarding > redeclarations. > > Here is an example: https://play.golang.org/p/

[go-nuts] Weird behavior of a nil check after variable redeclaration

2017-12-22 Thread Vincent Rischmann
Hello, while refactoring some code I encountered something strange regarding redeclarations. Here is an example: https://play.golang.org/p/b7Bp2w2fWwk Somehow after redeclaring err when calling doIt, err is apparently not nil, yet the functions never return anything other than nil. If I use a