[go] net: use readable JSON marshaling for IPNet, IPMask, HardwareAddr

17 views
Skip to first unread message

Ian Lance Taylor (Gerrit)

unread,
Mar 19, 2025, 12:55:11 PM3/19/25
to goph...@pubsubhelper.golang.org, Ian Lance Taylor, golang-co...@googlegroups.com

Ian Lance Taylor has uploaded the change for review

Commit message

net: use readable JSON marshaling for IPNet, IPMask, HardwareAddr

Adds a GODEBUG netreadablejson to control this.
The default is the current encoding, with a plan to change that in Go 1.27.
The unmarshaler recognizes both the current and the new encoding.

Fixes #29678
Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf

Change diff

diff --git a/api/next/29678.txt b/api/next/29678.txt
new file mode 100644
index 0000000..39cedfc
--- /dev/null
+++ b/api/next/29678.txt
@@ -0,0 +1,4 @@
+pkg net, method (*HardwareAddr) UnmarshalText([]uint8) error #29678
+pkg net, method (HardwareAddr) MarshalText() ([]uint8, error) #29678
+pkg net, method (*IPMask) UnmarshalText([]uint8) error #29678
+pkg net, method (IPMask) MarshalText() ([]uint8, error) #29678
diff --git a/doc/godebug.md b/doc/godebug.md
index f3ad820..e2a7102 100644
--- a/doc/godebug.md
+++ b/doc/godebug.md
@@ -169,6 +169,20 @@
The default value `embedfollowsymlinks=0` does not allow following
symlinks. `embedfollowsymlinks=1` will allow following symlinks.

+Go 1.25 added a new `netreadablejson` setting that controls whether
+the text marshaling of the types `net.IPMask`, `net.IPNet`, and
+`net.HardwareAddr` is readable. Text marshaling will be used for,
+among other things, JSON encoding, hence the name of the setting. The
+value `netreadablejson=0` will JSON encode those types using an
+unreadable base64 encoding. The value `netreadablejson=1` will use a
+readable version such as the IP address. For Go 1.25 and 1.26 the
+default value remains `netreadablejson=0`. This ensures that JSON
+generated by those versions will be readable by older versions of
+Go. The expectation is that Go 1.27 will change the default to be
+netreadablejson=1. Go 1.25 and all future releases will support both
+the old and new encodings when reading data. This setting may be
+removed in a future Go release, Go 1.31 at the earliest.
+
### Go 1.24

Go 1.24 added a new `fips140` setting that controls whether the Go
diff --git a/doc/next/6-stdlib/99-minor/net/29678.md b/doc/next/6-stdlib/99-minor/net/29678.md
new file mode 100644
index 0000000..51632a9
--- /dev/null
+++ b/doc/next/6-stdlib/99-minor/net/29678.md
@@ -0,0 +1,8 @@
+The [IPMask], [IPNet], and [HardwareAddr] types each now implement
+a [encoding.TextUnmarshaler] method. This method will recognize
+the current marshaling of those types, as well as a planned future
+marshaling format. The future marshaling format will be readable
+in JSON format, unlike the current format which is a base64 encoding.
+The future marshaling format will become the default in a later Go release.
+This is being done as a two-step process so that JSON generated
+by this release of Go can still be read by earlier releases of Go.
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
index c355cb4..60d6878 100644
--- a/src/go/build/deps_test.go
+++ b/src/go/build/deps_test.go
@@ -406,6 +406,7 @@
golang.org/x/net/dns/dnsmessage,
golang.org/x/net/lif,
internal/godebug,
+ internal/goversion,
internal/nettrace,
internal/poll,
internal/routebsd,
diff --git a/src/internal/godebugs/table.go b/src/internal/godebugs/table.go
index 26d079c..61b51eb 100644
--- a/src/internal/godebugs/table.go
+++ b/src/internal/godebugs/table.go
@@ -50,6 +50,7 @@
{Name: "multipathtcp", Package: "net", Changed: 24, Old: "0"},
{Name: "netdns", Package: "net", Opaque: true},
{Name: "netedns0", Package: "net", Changed: 19, Old: "0"},
+ {Name: "netreadablejson", Package: "net", Changed: 27, Old: "0"},
{Name: "panicnil", Package: "runtime", Changed: 21, Old: "1"},
{Name: "randautoseed", Package: "math/rand"},
{Name: "randseednop", Package: "math/rand", Changed: 24, Old: "0"},
diff --git a/src/net/ip.go b/src/net/ip.go
index e3ee6ca..56a1e30 100644
--- a/src/net/ip.go
+++ b/src/net/ip.go
@@ -14,6 +14,8 @@

import (
"internal/bytealg"
+ "internal/godebug"
+ "internal/goversion"
"internal/itoa"
"internal/stringslite"
"net/netip"
@@ -453,6 +455,63 @@
return hexString(m)
}

+var netreadablejson = godebug.New("netreadablejson")
+
+// MarshalText implements the [encoding.TextMarshaler] interface.
+// We marshal an IPMask as though it were an IP address.
+func (m IPMask) MarshalText() ([]byte, error) {
+ // For backward compatibility, GODEBUG=netreadablejson=0
+ // marshals as plain []byte.
+ if netreadablejson.Value() == "0" {
+ // We currently expect that the default for Go <= 1.26 is 0,
+ // and the default for Go >= 1.27 is 1.
+ if goversion.Version >= 27 {
+ netreadablejson.IncNonDefault()
+ }
+
+ return base64Encode(m), nil
+ }
+
+ // We currently expect that the default for Go <= 1.26 is 0,
+ // and the default for Go >= 1.27 is 1.
+ if goversion.Version <= 26 {
+ netreadablejson.IncNonDefault()
+ }
+
+ // We don't use IP.MarshalText directly because
+ // we want to preserve the length.
+ addr, _ := netip.AddrFromSlice(m)
+ return addr.AppendTo(nil), nil
+}
+
+// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
+// In older Go versions the JSON encoding of IPMask was
+// that of a []byte. In order to support new Go programs reading JSON
+// encodings produced by old Go programs, we support the []byte encoding.
+func (m *IPMask) UnmarshalText(text []byte) error {
+ var ip IP
+ err := ip.UnmarshalText(text)
+ if err == nil {
+ if bytealg.IndexByte(text, ':') < 0 {
+ ip = ip.To4()
+ }
+ *m = IPMask(ip)
+ return nil
+ }
+
+ // IP.Unmarshal failed; try base64.
+
+ dst := make([]byte, len(text)/4*3)
+ n, ok := base64Decode(dst, text)
+ if ok {
+ *m = IPMask(dst[:n])
+ return nil
+ }
+
+ // The base64 decode failed: return the IP.Unmarshal error.
+ return err
+}
+
func networkNumberAndMask(n *IPNet) (ip IP, m IPMask) {
if ip = n.IP.To4(); ip == nil {
ip = n.IP
@@ -572,3 +631,119 @@
copy(y, x)
return y
}
+
+// base64Coding is the standard base64 coding characters.
+const base64Coding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
+
+// base64Encode returned src encoded as base64,
+// assuming the standard encoding.
+// This stores (len(src) + 2) / 3 * 4 bytes into dst.
+// This is here so that the net package doesn't depend on encoding/base64.
+func base64Encode(src []byte) []byte {
+ dst := make([]byte, (len(src)+2)/3*4)
+
+ di, si := 0, 0
+ n := len(src) / 3 * 3
+ for si < n {
+ val := uint(src[si+0])<<16 | uint(src[si+1])<<8 | uint(src[si+2])
+
+ dst[di+0] = base64Coding[(val>>18)&0x3F]
+ dst[di+1] = base64Coding[(val>>12)&0x3F]
+ dst[di+2] = base64Coding[(val>>6)&0x3F]
+ dst[di+3] = base64Coding[val&0x3F]
+
+ si += 3
+ di += 4
+ }
+
+ remain := len(src) - si
+ if remain == 0 {
+ return dst
+ }
+
+ val := uint(src[si+0]) << 16
+ if remain == 2 {
+ val |= uint(src[si+1]) << 8
+ }
+
+ dst[di+0] = base64Coding[(val>>18)&0x3F]
+ dst[di+1] = base64Coding[(val>>12)&0x3F]
+
+ switch remain {
+ case 2:
+ dst[di+2] = base64Coding[(val>>6)&0x3F]
+ dst[di+3] = '='
+ case 1:
+ dst[di+2] = '='
+ dst[di+3] = '='
+ }
+
+ return dst
+}
+
+// base64Decode decodes base64 data from text into dst,
+// assuming the standard encoding.
+// It returns the number of bytes placed in dst,
+// and whether the decode was successful.
+// This is here so that the net package doesn't depend on encoding/base64.
+func base64Decode(dst, text []byte) (int, bool) {
+ n := 0
+ for len(text) > 0 {
+ var dbuf [4]byte
+ dlen := 4
+ for j := range dbuf {
+ if len(text) == 0 {
+ return 0, false
+ }
+ in := text[0]
+ text = text[1:]
+
+ // Check for padding at end of input.
+ if in == '=' {
+ switch j {
+ case 0, 1:
+ return 0, false
+ case 2:
+ // We expect one more padding character.
+ if len(text) != 1 || text[0] != '=' {
+ return 0, false
+ }
+ text = text[1:]
+ case 3:
+ if len(text) != 0 {
+ return 0, false
+ }
+ }
+
+ dlen = j
+ break
+ }
+
+ out := bytealg.IndexByteString(base64Coding, in)
+ if out < 0 {
+ return 0, false
+ }
+
+ dbuf[j] = byte(out)
+ }
+
+ // Convert 4 6-bit sources into 3 bytes.
+ val := uint32(dbuf[0])<<18 | uint32(dbuf[1])<<12 | uint32(dbuf[2])<<6 | uint32(dbuf[3])
+ dbuf[2], dbuf[1], dbuf[0] = byte(val>>0), byte(val>>8), byte(val>>16)
+ switch dlen {
+ case 4:
+ dst[2] = dbuf[2]
+ fallthrough
+ case 3:
+ dst[1] = dbuf[1]
+ fallthrough
+ case 2:
+ dst[0] = dbuf[0]
+ }
+
+ dst = dst[3:]
+ n += dlen - 1
+ }
+
+ return n, true
+}
diff --git a/src/net/ip_test.go b/src/net/ip_test.go
index 55c66fd..9e7e1c7 100644
--- a/src/net/ip_test.go
+++ b/src/net/ip_test.go
@@ -6,9 +6,11 @@

import (
"bytes"
+ "encoding/json"
"math/rand"
"reflect"
"runtime"
+ "slices"
"testing"
)

@@ -389,6 +391,90 @@
}
}

+var ipMaskJSONTests = []struct {
+ in IPMask
+ out0 string // expected marshaling with GODEBUG=netreadablejson=0
+ out1 string // expected marshaling with GODEBUG=netreadablejson=1
+}{
+ {
+ nil,
+ `""`,
+ `""`,
+ },
+ {
+ IPv4Mask(255, 255, 255, 0),
+ `"////AA=="`,
+ `"255.255.255.0"`,
+ },
+ {
+ IPMask(ParseIP("ffff:ff80::")),
+ `"////gAAAAAAAAAAAAAAAAA=="`,
+ `"ffff:ff80::"`,
+ },
+}
+
+func TestIPMaskJSON(t *testing.T) {
+ // testReadable tests that we can marshal m and unmarshal the result.
+ // We will call this with different GODEBUG settings to make
+ // sure that the unmarshaler, which doesn't check GODEBUG,
+ // works in all scenarios.
+ testReadable := func(m IPMask) {
+ b, err := json.Marshal(m)
+ if err != nil {
+ t.Errorf("json.Marshal(%s) failed: %v", m, err)
+ return
+ }
+
+ var m2 IPMask
+ if err = json.Unmarshal(b, &m2); err != nil {
+ t.Errorf("json.Unmarshal of %q (from %s) failed: %v", b, m, err)
+ return
+ }
+
+ if !slices.Equal(m, m2) {
+ t.Errorf("%s marshaled to %q, unmarshaled to different value %s", m, b, m2)
+ }
+ }
+
+ for _, d := range []string{"unset", "0", "1"} {
+ t.Run("GODEBUG="+d, func(t *testing.T) {
+ if d != "unset" {
+ t.Setenv("GODEBUG", "netreadablejson="+d)
+
+ for _, tt := range ipMaskJSONTests {
+ b, err := json.Marshal(tt.in)
+ if err != nil {
+ t.Errorf("json.Marshal(%s) failed: %v", tt.in, err)
+ continue
+ }
+ var want string
+ if d == "0" {
+ want = tt.out0
+ } else {
+ want = tt.out1
+ }
+ if string(b) != want {
+ t.Errorf("json.Marshal(%s) = %q, want %q", tt.in, b, want)
+ }
+ }
+ }
+
+ testReadable(nil)
+ testReadable(classAMask)
+ testReadable(classBMask)
+ testReadable(classCMask)
+
+ for _, tt := range ipMaskTests {
+ testReadable(tt.mask)
+ }
+
+ for _, tt := range ipMaskStringTests {
+ testReadable(tt.in)
+ }
+ })
+ }
+}
+
func BenchmarkIPMaskString(b *testing.B) {
testHookUninstaller.Do(uninstallTestHooks)

@@ -559,6 +645,93 @@
}
}

+var ipNetJSONTests = []struct {
+ in IPNet
+ out0 string // expected marshaling with GODEBUG=netreadablejson=0
+ out1 string // expected marshaling with GODEBUG=netreadablejson=1
+}{
+ {
+ IPNet{IP: IPv4(0, 0, 0, 0), Mask: IPv4Mask(255, 255, 255, 0)},
+ `{"IP":"0.0.0.0","Mask":"////AA=="}`,
+ `{"IP":"0.0.0.0","Mask":"255.255.255.0"}`,
+ },
+ {
+ IPNet{IP: IPv4(172, 16, 0, 0), Mask: CIDRMask(12, 32)},
+ `{"IP":"172.16.0.0","Mask":"//AAAA=="}`,
+ `{"IP":"172.16.0.0","Mask":"255.240.0.0"}`,
+ },
+ {
+ IPNet{IP: ParseIP("2001:db8:1::"), Mask: CIDRMask(47, 128)},
+ `{"IP":"2001:db8:1::","Mask":"///////+AAAAAAAAAAAAAA=="}`,
+ `{"IP":"2001:db8:1::","Mask":"ffff:ffff:fffe::"}`,
+ },
+}
+
+func TestIPNetJSON(t *testing.T) {
+ // testReadable tests that we can marshal n and unmarshal the result.
+ // We will call this with different GODEBUG settings to make
+ // sure that the unmarshaler, which doesn't check GODEBUG,
+ // works in all scenarios.
+ testReadable := func(n *IPNet) {
+ b, err := json.Marshal(n)
+ if err != nil {
+ t.Errorf("json.Marshal(%s) failed: %v", n, err)
+ return
+ }
+
+ var n2 IPNet
+ if err = json.Unmarshal(b, &n2); err != nil {
+ t.Errorf("json.Unmarshal of %q (from %s) failed: %v", b, n, err)
+ return
+ }
+
+ var equal bool
+ if n == nil {
+ equal = len(n2.IP) == 0 && len(n2.Mask) == 0
+ } else {
+ equal = n.IP.Equal(n2.IP) && slices.Equal(n.Mask, n2.Mask)
+ }
+ if !equal {
+ t.Errorf("%s marshaled to %q, unmarshaled to different value %s", n, b, n2)
+ }
+ }
+
+ for _, d := range []string{"unset", "0", "1"} {
+ t.Run("GODEBUG="+d, func(t *testing.T) {
+ if d != "unset" {
+ t.Setenv("GODEBUG", "netreadablejson="+d)
+
+ for _, tt := range ipNetJSONTests {
+ b, err := json.Marshal(tt.in)
+ if err != nil {
+ t.Errorf("json.Marshal(%s) failed: %v", tt.in, err)
+ continue
+ }
+ var want string
+ if d == "0" {
+ want = tt.out0
+ } else {
+ want = tt.out1
+ }
+ if string(b) != want {
+ t.Errorf("json.Marshal(%s) = %q, want %q", tt.in, b, want)
+ }
+ }
+ }
+
+ for _, tt := range parseCIDRTests {
+ testReadable(tt.net)
+ }
+ for _, tt := range ipNetContainsTests {
+ testReadable(tt.net)
+ }
+ for _, tt := range ipNetStringTests {
+ testReadable(tt.in)
+ }
+ })
+ }
+}
+
func TestSplitHostPort(t *testing.T) {
for _, tt := range []struct {
hostPort string
diff --git a/src/net/mac.go b/src/net/mac.go
index 53d5b2d..5e9ff42 100644
--- a/src/net/mac.go
+++ b/src/net/mac.go
@@ -4,6 +4,10 @@

package net

+import (
+ "internal/goversion"
+)
+
const hexDigit = "0123456789abcdef"

// A HardwareAddr represents a physical hardware address.
@@ -84,3 +88,52 @@
error:
return nil, &AddrError{Err: "invalid MAC address", Addr: s}
}
+
+// MarshalText implements the [encoding.TextMarshaler] interface.
+// The encoding is the same as the one returned by [HardwareAddr.String].
+// This will be enabled in a future Go release; see issue #29678.
+func (a HardwareAddr) MarshalText() ([]byte, error) {
+ // For backward compatibility, GODEBUG=netreadablejson=0
+ // marshals as plain []byte.
+ if netreadablejson.Value() == "0" {
+ // We currently expect that the default for Go <= 1.26 is 0,
+ // and the default for Go >= 1.27 is 1.
+ if goversion.Version >= 27 {
+ netreadablejson.IncNonDefault()
+ }
+
+ return base64Encode(a), nil
+ }
+
+ // We currently expect that the default for Go <= 1.26 is 0,
+ // and the default for Go >= 1.27 is 1.
+ if goversion.Version <= 26 {
+ netreadablejson.IncNonDefault()
+ }
+
+ return []byte(a.String()), nil
+}
+
+// UnmarshalText implements the [encoding.TextUnmarshaler] interface.
+// In older Go versions the JSON encoding of HardwareAddr was
+// that of a []byte. In order to support new Go programs reading JSON
+// encodings produced by old Go programs, we support the []byte encoding.
+func (a *HardwareAddr) UnmarshalText(text []byte) error {
+ hw, err := ParseMAC(string(text))
+ if err == nil {
+ *a = hw
+ return nil
+ }
+
+ // ParseMAC failed: try base64.
+
+ dst := make([]byte, len(text)/4*3)
+ n, ok := base64Decode(dst, text)
+ if ok {
+ *a = HardwareAddr(dst[:n])
+ return nil
+ }
+
+ // The base64 decode failed: return the ParseMAC error.
+ return err
+}
diff --git a/src/net/mac_test.go b/src/net/mac_test.go
index cad884f..5530e71 100644
--- a/src/net/mac_test.go
+++ b/src/net/mac_test.go
@@ -5,7 +5,9 @@
package net

import (
+ "encoding/json"
"reflect"
+ "slices"
"strings"
"testing"
)
@@ -107,3 +109,78 @@
}
}
}
+
+var hardwareAddrJSONTests = []struct {
+ in HardwareAddr
+ out0 string // expected marshaling with GODEBUG=netreadablejson=0
+ out1 string // expected marshaling with GODEBUG=netreadablejson=1
+}{
+ {
+ nil,
+ `""`,
+ `""`,
+ },
+ {
+ HardwareAddr{0x00, 0x00, 0x5e, 0x00, 0x53, 0x01},
+ `"AABeAFMB"`,
+ `"00:00:5e:00:53:01"`,
+ },
+}
+
+// TestMACJSON tests JSON marshaling for HardwareAddr.
+func TestMACJSON(t *testing.T) {
+ // testReadable tests that we can marshal hw and unmarshal the result.
+ // We will call this with different GODEBUG settings to make
+ // sure that the unmarshaler, which doesn't check GODEBUG,
+ // works in all scenarios.
+ testReadable := func(hw HardwareAddr) {
+ b, err := json.Marshal(hw)
+ if err != nil {
+ t.Errorf("json.Marshal(%s) failed: %v", hw, err)
+ return
+ }
+
+ var hw2 HardwareAddr
+ if err = json.Unmarshal(b, &hw2); err != nil {
+ t.Errorf("json.Unmarshal of %q (from %s) failed: %v", b, hw, err)
+ return
+ }
+
+ if !slices.Equal(hw, hw2) {
+ t.Errorf("%s marshaled to %q, unmarshaled to different value %s", hw, b, hw2)
+ }
+ }
+
+ for _, d := range []string{"unset", "0", "1"} {
+ t.Run("GODEBUG="+d, func(t *testing.T) {
+ if d != "unset" {
+ t.Setenv("GODEBUG", "netreadablejson="+d)
+
+ for _, tt := range hardwareAddrJSONTests {
+ b, err := json.Marshal(tt.in)
+ if err != nil {
+ t.Errorf("json.Marshal(%s) failed: %v", tt.in, err)
+ continue
+ }
+ var want string
+ if d == "0" {
+ want = tt.out0
+ } else {
+ want = tt.out1
+ }
+ if string(b) != want {
+ t.Errorf("json.Marshal(%s) = %q, want %q", tt.in, b, want)
+ }
+ }
+ }
+
+ testReadable(nil)
+
+ for _, tt := range parseMACTests {
+ if tt.out != nil {
+ testReadable(tt.out)
+ }
+ }
+ })
+ }
+}
diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go
index 0d35314e..79dd684 100644
--- a/src/runtime/metrics/doc.go
+++ b/src/runtime/metrics/doc.go
@@ -308,6 +308,10 @@
The number of non-default behaviors executed by the net package
due to a non-default GODEBUG=netedns0=... setting.

+ /godebug/non-default-behavior/netreadablejson:events
+ The number of non-default behaviors executed by the net package
+ due to a non-default GODEBUG=netreadablejson=... setting.
+
/godebug/non-default-behavior/panicnil:events
The number of non-default behaviors executed by the runtime
package due to a non-default GODEBUG=panicnil=... setting.

Change information

Files:
  • A api/next/29678.txt
  • M doc/godebug.md
  • A doc/next/6-stdlib/99-minor/net/29678.md
  • M src/go/build/deps_test.go
  • M src/internal/godebugs/table.go
  • M src/net/ip.go
  • M src/net/ip_test.go
  • M src/net/mac.go
  • M src/net/mac_test.go
  • M src/runtime/metrics/doc.go
Change size: L
Delta: 10 files changed, 510 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
Gerrit-Change-Number: 659315
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
unsatisfied_requirement
satisfied_requirement
open
diffy

Damien Neil (Gerrit)

unread,
Mar 19, 2025, 1:22:02 PM3/19/25
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Go LUCI, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Ian Lance Taylor and Russ Cox

Damien Neil voted and added 1 comment

Votes added by Damien Neil

Code-Review+2

1 comment

File src/net/ip.go
Line 638, Patchset 1 (Latest):// base64Encode returned src encoded as base64,
Damien Neil . unresolved

typo: returns

Open in Gerrit

Related details

Attention is currently required from:
  • Ian Lance Taylor
  • Russ Cox
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
Gerrit-Change-Number: 659315
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: Russ Cox <r...@golang.org>
Gerrit-Comment-Date: Wed, 19 Mar 2025 17:21:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Mar 19, 2025, 1:45:44 PM3/19/25
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Ian Lance Taylor and Russ Cox

Ian Lance Taylor uploaded new patchset

Ian Lance Taylor uploaded patch set #2 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit

Related details

Attention is currently required from:
  • Ian Lance Taylor
  • Russ Cox
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
    Gerrit-Change-Number: 659315
    Gerrit-PatchSet: 2
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Mar 19, 2025, 1:45:53 PM3/19/25
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Damien Neil, Go LUCI, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Ian Lance Taylor added 1 comment

    File src/net/ip.go
    Line 638, Patchset 1:// base64Encode returned src encoded as base64,
    Damien Neil . resolved

    typo: returns

    Ian Lance Taylor

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
    Gerrit-Change-Number: 659315
    Gerrit-PatchSet: 1
    Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Wed, 19 Mar 2025 17:45:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Damien Neil <dn...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Damien Neil (Gerrit)

    unread,
    Mar 19, 2025, 2:08:06 PM3/19/25
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Go LUCI, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Ian Lance Taylor and Russ Cox

    Damien Neil voted Code-Review+2

    Code-Review+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Lance Taylor
    • Russ Cox
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
    Gerrit-Change-Number: 659315
    Gerrit-PatchSet: 2
    Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Wed, 19 Mar 2025 18:07:52 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Mar 19, 2025, 2:37:17 PM3/19/25
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Go LUCI, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Russ Cox

    Ian Lance Taylor voted and added 1 comment

    Votes added by Ian Lance Taylor

    Hold+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    Ian Lance Taylor . resolved

    On hold for proposal.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Russ Cox
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Holds
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
    Gerrit-Change-Number: 659315
    Gerrit-PatchSet: 2
    Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Wed, 19 Mar 2025 18:37:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sean Liao (Gerrit)

    unread,
    May 13, 2025, 3:16:45 PM5/13/25
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Go LUCI, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Ian Lance Taylor and Russ Cox

    Sean Liao added 1 comment

    Patchset-level comments
    Sean Liao . resolved

    The proposal was accepted, I think this just needs to rename the godebug to `netmarshal`, and do the same for IPNet.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Lance Taylor
    • Russ Cox
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Holds
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
    Gerrit-Change-Number: 659315
    Gerrit-PatchSet: 2
    Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Sean Liao <se...@liao.dev>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 13 May 2025 19:16:37 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dmitri Shuralyov (Gerrit)

    unread,
    May 20, 2026, 10:18:22 PMMay 20
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Dmitri Shuralyov, golang...@luci-project-accounts.iam.gserviceaccount.com, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Ian Lance Taylor and Russ Cox

    Dmitri Shuralyov added 1 comment

    Patchset-level comments
    Sean Liao . unresolved

    The proposal was accepted, I think this just needs to rename the godebug to `netmarshal`, and do the same for IPNet.

    Dmitri Shuralyov

    Unresolving this for visibility and removing Hold.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Lance Taylor
    • Russ Cox
    Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Holds
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedNo-Wait-Release
      • requirement is not satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
      Gerrit-Change-Number: 659315
      Gerrit-PatchSet: 2
      Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Damien Neil <dn...@google.com>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Sean Liao <se...@liao.dev>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Comment-Date: Thu, 21 May 2026 02:18:19 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Sean Liao <se...@liao.dev>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Dmitri Shuralyov (Gerrit)

      unread,
      May 20, 2026, 10:18:28 PMMay 20
      to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Dmitri Shuralyov, golang...@luci-project-accounts.iam.gserviceaccount.com, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Ian Lance Taylor and Russ Cox

      Dmitri Shuralyov removed a vote from this change

      Removed Hold+1 by Ian Lance Taylor <ia...@golang.org>
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ian Lance Taylor
      • Russ Cox
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedNo-Wait-Release
      • requirement is not satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: deleteVote
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Ian Lance Taylor (Gerrit)

      unread,
      May 21, 2026, 4:54:40 PMMay 21
      to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Ian Lance Taylor and Russ Cox

      Ian Lance Taylor uploaded new patchset

      Ian Lance Taylor uploaded patch set #3 to this change.
      Following approvals got outdated and were removed:

      Related details

      Attention is currently required from:
      • Ian Lance Taylor
      • Russ Cox
      Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedNo-Wait-Release
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
        Gerrit-Change-Number: 659315
        Gerrit-PatchSet: 3
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Russ Cox (Gerrit)

        unread,
        Jul 29, 2026, 12:23:19 PM (14 days ago) Jul 29
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Damien Neil and Ian Lance Taylor

        Russ Cox removed a vote from this change

        Removed Code-Review+2 by Damien Neil <dn...@google.com>
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Damien Neil
        • Ian Lance Taylor
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: deleteVote
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
        Gerrit-Change-Number: 659315
        Gerrit-PatchSet: 3
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Damien Neil <dn...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Sean Liao <se...@liao.dev>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Damien Neil <dn...@google.com>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Russ Cox (Gerrit)

        unread,
        Jul 29, 2026, 12:23:36 PM (14 days ago) Jul 29
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Ian Lance Taylor

        Russ Cox added 5 comments

        Patchset-level comments
        File-level comment, Patchset 3 (Latest):
        Russ Cox . unresolved

        The accepted proposal lists changes to IPNet as well. It looks like those are missing from this CL.

        File doc/godebug.md
        Line 164, Patchset 3 (Latest):For Go 1.28 and 1.29 thedefault value remains `netmarshal=0`.
        Russ Cox . unresolved

        s/the/& /

        File src/internal/godebugs/table.go
        Line 58, Patchset 3 (Latest): {Name: "netmarshal", Package: "net", Changed: 29, Old: "0"},
        Russ Cox . unresolved

        s/29/30/

        File src/net/ip.go
        Line 467, Patchset 3 (Latest): // For backward compatibility, GODEBUG=netmarshal=0
        Russ Cox . unresolved

        The godebug API usage doesn't look right to me. Unless there is an explicit setting, Value() returns "". If you want to make that key off the version automatically instead of having to return to this code, the way to do that would be:

        ```
        form := netmarshal.Value()
        switch form {
        case "":
        if goversion.Version < 30 {
        form = "0"
        } else {
        form = "1"
        }
        case "0":
        if goversion.Version >= 30 {
        netmarshal.IncNonDefault()
        }
        default:
        if goversion.Version < 30 {
        netmarshal.IncNonDefault()
        }
        }

        if form == "0" { ... base 64 ... }
        ... text ...
        ```

        The form logic might be worth pulling into its own function since it will be used elsewhere too.

        File src/net/mac.go
        Line 113, Patchset 3 (Latest): // For backward compatibility, GODEBUG=netmarshal=0
        Russ Cox . unresolved

        Same comments about netmarshal.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ian Lance Taylor
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
        Gerrit-Change-Number: 659315
        Gerrit-PatchSet: 3
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Damien Neil <dn...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Sean Liao <se...@liao.dev>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Comment-Date: Wed, 29 Jul 2026 16:22:46 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Russ Cox (Gerrit)

        unread,
        Jul 29, 2026, 12:23:42 PM (14 days ago) Jul 29
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Damien Neil and Ian Lance Taylor

        Russ Cox added 1 comment

        Patchset-level comments
        Russ Cox . resolved

        (Removed Damien's +2 because it was pre-proposal.)

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Damien Neil
        • Ian Lance Taylor
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
        Gerrit-Change-Number: 659315
        Gerrit-PatchSet: 3
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Damien Neil <dn...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Sean Liao <se...@liao.dev>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Damien Neil <dn...@google.com>
        Gerrit-Comment-Date: Wed, 29 Jul 2026 16:23:33 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Russ Cox (Gerrit)

        unread,
        Jul 29, 2026, 12:26:20 PM (14 days ago) Jul 29
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Damien Neil and Ian Lance Taylor

        Russ Cox added 1 comment

        File src/net/ip.go
        Line 644, Patchset 3 (Latest):// This stores (len(src) + 2) / 3 * 4 bytes into dst.
        Russ Cox . unresolved

        Stale. Delete line.

        Gerrit-Comment-Date: Wed, 29 Jul 2026 16:26:11 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Ian Lance Taylor (Gerrit)

        unread,
        Aug 5, 2026, 4:56:27 PM (6 days ago) Aug 5
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Damien Neil and Ian Lance Taylor

        Ian Lance Taylor uploaded new patchset

        Ian Lance Taylor uploaded patch set #4 to this change.
        Following approvals got outdated and were removed:

        Related details

        Attention is currently required from:
        • Damien Neil
        • Ian Lance Taylor
        Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
          Gerrit-Change-Number: 659315
          Gerrit-PatchSet: 4
          unsatisfied_requirement
          open
          diffy

          Ian Lance Taylor (Gerrit)

          unread,
          Aug 5, 2026, 4:56:36 PM (6 days ago) Aug 5
          to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
          Attention needed from Damien Neil and Russ Cox

          Ian Lance Taylor added 6 comments

          Patchset-level comments

          The accepted proposal lists changes to IPNet as well. It looks like those are missing from this CL.

          Ian Lance Taylor

          IPNet includes a field of type IP. The changes to IP marshaling affect IPNet marshaling. This is tested by TestIPNetJSON.

          File doc/godebug.md
          Line 164, Patchset 3:For Go 1.28 and 1.29 thedefault value remains `netmarshal=0`.
          Russ Cox . resolved

          s/the/& /

          Ian Lance Taylor

          Done

          File src/internal/godebugs/table.go
          Line 58, Patchset 3: {Name: "netmarshal", Package: "net", Changed: 29, Old: "0"},
          Russ Cox . resolved

          s/29/30/

          Ian Lance Taylor

          Done

          File src/net/ip.go
          Line 467, Patchset 3: // For backward compatibility, GODEBUG=netmarshal=0
          Russ Cox . resolved

          The godebug API usage doesn't look right to me. Unless there is an explicit setting, Value() returns "". If you want to make that key off the version automatically instead of having to return to this code, the way to do that would be:

          ```
          form := netmarshal.Value()
          switch form {
          case "":
          if goversion.Version < 30 {
          form = "0"
          } else {
          form = "1"
          }
          case "0":
          if goversion.Version >= 30 {
          netmarshal.IncNonDefault()
          }
          default:
          if goversion.Version < 30 {
          netmarshal.IncNonDefault()
          }
          }

          if form == "0" { ... base 64 ... }
          ... text ...
          ```

          The form logic might be worth pulling into its own function since it will be used elsewhere too.

          Ian Lance Taylor

          Thanks, done.

          Line 644, Patchset 3:// This stores (len(src) + 2) / 3 * 4 bytes into dst.
          Russ Cox . resolved

          Stale. Delete line.

          Ian Lance Taylor

          Done

          File src/net/mac.go
          Line 113, Patchset 3: // For backward compatibility, GODEBUG=netmarshal=0
          Russ Cox . resolved

          Same comments about netmarshal.

          Ian Lance Taylor

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Damien Neil
          • Russ Cox
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
          Gerrit-Change-Number: 659315
          Gerrit-PatchSet: 3
          Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Damien Neil <dn...@google.com>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Russ Cox <r...@golang.org>
          Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
          Gerrit-CC: Gopher Robot <go...@golang.org>
          Gerrit-CC: Sean Liao <se...@liao.dev>
          Gerrit-Attention: Russ Cox <r...@golang.org>
          Gerrit-Attention: Damien Neil <dn...@google.com>
          Gerrit-Comment-Date: Wed, 05 Aug 2026 20:56:31 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Russ Cox <r...@golang.org>
          unsatisfied_requirement
          open
          diffy

          Ian Lance Taylor (Gerrit)

          unread,
          Aug 5, 2026, 4:57:43 PM (6 days ago) Aug 5
          to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
          Attention needed from Damien Neil, Dmitri Shuralyov, Russ Cox and Sean Liao

          Ian Lance Taylor added 1 comment

          Patchset-level comments

          The proposal was accepted, I think this just needs to rename the godebug to `netmarshal`, and do the same for IPNet.

          Dmitri Shuralyov

          Unresolving this for visibility and removing Hold.

          Ian Lance Taylor

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Damien Neil
          • Dmitri Shuralyov
          • Russ Cox
          • Sean Liao
          Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
            Gerrit-Change-Number: 659315
            Gerrit-PatchSet: 4
            Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Damien Neil <dn...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Russ Cox <r...@golang.org>
            Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-CC: Sean Liao <se...@liao.dev>
            Gerrit-Attention: Russ Cox <r...@golang.org>
            Gerrit-Attention: Sean Liao <se...@liao.dev>
            Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
            Gerrit-Attention: Damien Neil <dn...@google.com>
            Gerrit-Comment-Date: Wed, 05 Aug 2026 20:57:38 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Sean Liao <se...@liao.dev>
            Comment-In-Reply-To: Dmitri Shuralyov <dmit...@golang.org>
            unsatisfied_requirement
            satisfied_requirement
            open
            diffy

            Sean Liao (Gerrit)

            unread,
            Aug 8, 2026, 1:34:43 PM (4 days ago) Aug 8
            to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Damien Neil, Dmitri Shuralyov, Ian Lance Taylor and Russ Cox

            Sean Liao voted and added 1 comment

            Votes added by Sean Liao

            Code-Review+2

            1 comment

            Commit Message
            Line 10, Patchset 4 (Latest):The default is the current encoding, with a plan to change that in Go 1.29.
            Sean Liao . unresolved

            1.30?

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Damien Neil
            • Dmitri Shuralyov
            • Ian Lance Taylor
            • Russ Cox
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
            Gerrit-Change-Number: 659315
            Gerrit-PatchSet: 4
            Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Damien Neil <dn...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Russ Cox <r...@golang.org>
            Gerrit-Reviewer: Sean Liao <se...@liao.dev>
            Gerrit-Attention: Russ Cox <r...@golang.org>
            Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
            Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Attention: Damien Neil <dn...@google.com>
            Gerrit-Comment-Date: Sat, 08 Aug 2026 17:34:35 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Ian Lance Taylor (Gerrit)

            unread,
            Aug 8, 2026, 1:55:18 PM (4 days ago) Aug 8
            to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Damien Neil, Dmitri Shuralyov and Russ Cox

            Ian Lance Taylor added 1 comment

            Commit Message
            Line 10, Patchset 4:The default is the current encoding, with a plan to change that in Go 1.29.
            Sean Liao . resolved

            1.30?

            Ian Lance Taylor

            Done

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Damien Neil
            • Dmitri Shuralyov
            • Russ Cox
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
            Gerrit-Change-Number: 659315
            Gerrit-PatchSet: 4
            Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Damien Neil <dn...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Russ Cox <r...@golang.org>
            Gerrit-Reviewer: Sean Liao <se...@liao.dev>
            Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-Attention: Russ Cox <r...@golang.org>
            Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
            Gerrit-Attention: Damien Neil <dn...@google.com>
            Gerrit-Comment-Date: Sat, 08 Aug 2026 17:55:12 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Ian Lance Taylor (Gerrit)

            unread,
            Aug 8, 2026, 1:55:20 PM (4 days ago) Aug 8
            to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
            Attention needed from Damien Neil, Dmitri Shuralyov, Ian Lance Taylor and Russ Cox

            Ian Lance Taylor uploaded new patchset

            Ian Lance Taylor uploaded patch set #5 to this change.
            Following approvals got outdated and were removed:
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Damien Neil
            • Dmitri Shuralyov
            • Ian Lance Taylor
            • Russ Cox
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: newpatchset
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
            Gerrit-Change-Number: 659315
            Gerrit-PatchSet: 5
            Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Damien Neil <dn...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Russ Cox <r...@golang.org>
            Gerrit-Reviewer: Sean Liao <se...@liao.dev>
            Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-Attention: Russ Cox <r...@golang.org>
            Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Mark Freeman (Gerrit)

            unread,
            Aug 10, 2026, 11:08:50 AM (2 days ago) Aug 10
            to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Damien Neil, Dmitri Shuralyov, Ian Lance Taylor and Russ Cox

            Mark Freeman voted Code-Review+1

            Code-Review+1
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Damien Neil
            • Dmitri Shuralyov
            • Ian Lance Taylor
            • Russ Cox
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
            Gerrit-Change-Number: 659315
            Gerrit-PatchSet: 5
            Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Damien Neil <dn...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Mark Freeman <markf...@google.com>
            Gerrit-Reviewer: Russ Cox <r...@golang.org>
            Gerrit-Reviewer: Sean Liao <se...@liao.dev>
            Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-Attention: Russ Cox <r...@golang.org>
            Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
            Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Attention: Damien Neil <dn...@google.com>
            Gerrit-Comment-Date: Mon, 10 Aug 2026 15:08:46 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Dmitri Shuralyov (Gerrit)

            unread,
            Aug 10, 2026, 12:10:34 PM (2 days ago) Aug 10
            to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Mark Freeman, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Damien Neil, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Damien Neil, Ian Lance Taylor and Russ Cox

            Dmitri Shuralyov voted Code-Review+1

            Code-Review+1
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Damien Neil
            • Ian Lance Taylor
            • Russ Cox
              Submit Requirements:
                • requirement satisfiedCode-Review
                • requirement satisfiedNo-Unresolved-Comments
                • requirement satisfiedReview-Enforcement
                • requirement satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: comment
                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
                Gerrit-Change-Number: 659315
                Gerrit-PatchSet: 5
                Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
                Gerrit-Reviewer: Damien Neil <dn...@google.com>
                Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
                Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
                Gerrit-Reviewer: Mark Freeman <markf...@google.com>
                Gerrit-Reviewer: Russ Cox <r...@golang.org>
                Gerrit-Reviewer: Sean Liao <se...@liao.dev>
                Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
                Gerrit-CC: Gopher Robot <go...@golang.org>
                Gerrit-Attention: Russ Cox <r...@golang.org>
                Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
                Gerrit-Attention: Damien Neil <dn...@google.com>
                Gerrit-Comment-Date: Mon, 10 Aug 2026 16:10:30 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                open
                diffy

                Damien Neil (Gerrit)

                unread,
                Aug 11, 2026, 7:47:35 PM (8 hours ago) Aug 11
                to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Dmitri Shuralyov, Mark Freeman, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
                Attention needed from Ian Lance Taylor and Russ Cox

                Damien Neil voted Code-Review+2

                Code-Review+2
                Open in Gerrit

                Related details

                Attention is currently required from:
                Gerrit-Comment-Date: Tue, 11 Aug 2026 23:47:23 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                open
                diffy

                Ian Lance Taylor (Gerrit)

                unread,
                Aug 11, 2026, 8:21:30 PM (7 hours ago) Aug 11
                to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Damien Neil, Dmitri Shuralyov, Mark Freeman, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
                Attention needed from Russ Cox

                Ian Lance Taylor voted Auto-Submit+1

                Auto-Submit+1
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Russ Cox
                Gerrit-Comment-Date: Wed, 12 Aug 2026 00:21:24 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                open
                diffy

                Gopher Robot (Gerrit)

                unread,
                Aug 11, 2026, 8:23:59 PM (7 hours ago) Aug 11
                to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Damien Neil, Dmitri Shuralyov, Mark Freeman, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Russ Cox, golang-co...@googlegroups.com

                Gopher Robot submitted the change

                Change information

                Commit message:
                net: use readable JSON marshaling for IPNet, IPMask, HardwareAddr

                Adds a GODEBUG netmarshal to control this.
                The default is the current encoding, with a plan to change that in Go 1.30.

                The unmarshaler recognizes both the current and the new encoding.

                Fixes #29678
                Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
                Reviewed-by: Mark Freeman <markf...@google.com>
                Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
                Reviewed-by: Damien Neil <dn...@google.com>
                Reviewed-by: Sean Liao <se...@liao.dev>
                Auto-Submit: Ian Lance Taylor <ia...@golang.org>
                Files:
                • A api/next/29678.txt
                • M doc/godebug.md
                • A doc/next/6-stdlib/99-minor/net/29678.md
                • M src/go/build/deps_test.go
                • M src/internal/godebugs/table.go
                • M src/net/ip.go
                • M src/net/ip_test.go
                • M src/net/mac.go
                • M src/net/mac_test.go
                • M src/runtime/metrics/doc.go
                Change size: L
                Delta: 10 files changed, 503 insertions(+), 0 deletions(-)
                Branch: refs/heads/master
                Submit Requirements:
                Open in Gerrit
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: merged
                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: I50e86dd343b5dc5680cc47ddf5dbab96c4665daf
                Gerrit-Change-Number: 659315
                Gerrit-PatchSet: 6
                Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
                Gerrit-Reviewer: Damien Neil <dn...@google.com>
                Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
                Gerrit-Reviewer: Gopher Robot <go...@golang.org>
                open
                diffy
                satisfied_requirement
                Reply all
                Reply to author
                Forward
                0 new messages