Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net: implement MarshalText/UnmarshalText for IP type #5086
What steps will reproduce the problem? http://play.golang.org/p/o-7AnROIPq What is the expected output? The unmarshaled IP What do you see instead? Error json: cannot unmarshal string into Go value of type net.IP Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? Drarwin 11.4.2 Which version are you using? (run 'go version') go version devel +7bcfc5879223 Thu Mar 14 13:48:19 2013 +0400 darwin/amd64 Please provide any additional information below. A small discussion and a fix proposal here: https://groups.google.com/d/msg/golang-nuts/io8aHJarm6U/VFYIWdDvLsYJ.
Go 1.2: encoding.TextMarshaler and TextUnmarshaler https://groups.google.com/d/msg/golang-dev/pXLNF6lH9WE/qVMpNweYSgAJ Hm, we probably could assume that TextMarshaler will return a consistent address representation regardless of its internal address format; e.g., IPv6 IPv4-mapped net.IP(`::ffff:127.0.0.1`) or IPv4 net.IP(`127.0.0.1`).
Status changed to Accepted.