From: Yuval Pavel Zholkover Date: Wed, 22 Feb 2017 19:24:44 +0000 (+0200) Subject: net: update IP.MarshalText documentation regarding len(ip) == 0 X-Git-Tag: go1.9beta1~1464 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c804fd8927dabe1484b52e31f752136b7c0b32b7;p=gostls13.git net: update IP.MarshalText documentation regarding len(ip) == 0 Describe the difference from String encoding when len(ip) is zero. Change-Id: Ia9b36b405d4fec3fee9a77498a839b6d90c2ec0d Reviewed-on: https://go-review.googlesource.com/37379 Reviewed-by: Brad Fitzpatrick --- diff --git a/src/net/ip.go b/src/net/ip.go index c482ef6303..db6bc38798 100644 --- a/src/net/ip.go +++ b/src/net/ip.go @@ -340,7 +340,8 @@ func ipEmptyString(ip IP) string { } // MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by String. +// The encoding is the same as returned by String, with one exception: +// When len(ip) is zero, it returns an empty slice. func (ip IP) MarshalText() ([]byte, error) { if len(ip) == 0 { return []byte(""), nil