Skip to content

Comment on Multiple nil types in Go.

Comments

`make` allocates and initializes `a`, setting it to nil effectively uninitializes the variable. See below, where I declare `c`, but don't initialize it. From the Golang spec, http://golang.org/ref/spec#Map_types, the value of an uninitialized map is nil.

http://play.golang.org/p/J46-8OEWYS

Don't tell me, I merely added one line of code to show that more information than the interface{} being nil is kept.

This is even more interesting.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.