Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
encoding/gob: regression from Go 1.1 #6758
(copying here from elsewhere) The following program changes behavior from Go 1.1 to Go 1.2: http://play.golang.org/p/9JMYxpJdM_ Before: $ go version go version go1.1 linux/amd64 $ go run gob.go 127.0.0.1: 64900 127.0.0.1: 64900 After: $ go version go version devel +2a5e92c6efc9 Wed Nov 13 15:32:40 2013 +1100 linux/amd64 $ go run gob.go 127.0.0.1: 64900 127.0.0.1: 0
Go 1.2 defines some standard methods for types to encode themselves; see http://golang.org/s/go12encoding. encoding/gob will use those methods in preference to its own custom encoding. net.IP defines such a method. In the example, type N2 embeds a net.IP, which means it gets the custom encoding method from net.IP, which means gob uses that to encode an N2, which means it ignores the other field. The String method used by fmt.Printf behaves the same way. If you don't want all the methods from net.IP to attach to N2 (and it seems you do not), you must not embed it in N2. http://play.golang.org/p/KT7MJWRypJ This is fundamental to the way embedding works. The same
Status changed to Unfortunate.