mirror of
https://github.com/golang/go
synced 2024-11-18 14:34:39 -07:00
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 <bradfitz@golang.org>
This commit is contained in:
parent
8c6643846e
commit
c804fd8927
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user