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: decoding of pointers with two levels of indirection is broken #8872
go version 1.3.3 (happens at play.golang.org, too) What steps reproduce the problem? 1. Create two structs A and B. 2. Let B contain an exported int I, and A an exported pointer to a pointer to B named P. 3. Create an instance of B, set I, create an instance of A and let X point to a pointer to the instance of B. 4. Encode with Gob. 5. Decode with Gob. => The value of I is incorrect. Example: http://play.golang.org/p/RZj-VdGNvL What happened? Gob does not properly decode pointers with two levels of indirection. It seems that the decoder adds another level of indirection (one to many). Example where you can see this : http://play.golang.org/p/JkOWiyrHpE What should have happened instead? Pointers should be decoded correctly. Please provide any additional information below. There were issues with pointers in the past like : https://code.google.com/p/go/source/detail?r=97815e81c184 decIndirect in the decoder is called twice with indir = 2 in the decoding process for A. The second or the first call should use 1. I did not look into it deep enough to provide a fix / suggestion.