diff options
| author | Joe Tsai <joetsai@digital-static.net> | 2025-06-24 20:30:29 -0700 |
|---|---|---|
| committer | Joseph Tsai <joetsai@digital-static.net> | 2025-06-25 13:56:35 -0700 |
| commit | 0b4d2eab2f7a20917639f0025de39ce9f0198d9f (patch) | |
| tree | 9ee21be3f0ee8589df64927141b46a465bc074b3 /src/encoding/json/v2 | |
| parent | f8ccda2e0574c9ca5d92068852a34b463f87a85b (diff) | |
| download | go-0b4d2eab2f7a20917639f0025de39ce9f0198d9f.tar.xz | |
encoding/json/jsontext: rename Encoder.UnusedBuffer as Encoder.AvailableBuffer
This follows the precedent set by:
bufio.Writer.AvailableBuffer
bytes.Buffer.AvailableBuffer
both with methods that return a zero-length buffer that
is intended to only be used with a following Write call.
This keeps the older UnusedBuffer method around so that
at least one commit that has both methods for migration purposes.
Updates #71497
Change-Id: I3815f593e09f645280ae5ad9cbdd63a6c147123b
Reviewed-on: https://go-review.googlesource.com/c/go/+/683896
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/encoding/json/v2')
| -rw-r--r-- | src/encoding/json/v2/arshal_inlined.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/encoding/json/v2/arshal_inlined.go b/src/encoding/json/v2/arshal_inlined.go index 0b5782fdcc..6299cc4a42 100644 --- a/src/encoding/json/v2/arshal_inlined.go +++ b/src/encoding/json/v2/arshal_inlined.go @@ -113,7 +113,7 @@ func marshalInlinedFallbackAll(enc *jsontext.Encoder, va addressableValue, mo *j mk := newAddressableValue(m.Type().Key()) mv := newAddressableValue(m.Type().Elem()) marshalKey := func(mk addressableValue) error { - b, err := jsonwire.AppendQuote(enc.UnusedBuffer(), mk.String(), &mo.Flags) + b, err := jsonwire.AppendQuote(enc.AvailableBuffer(), mk.String(), &mo.Flags) if err != nil { return newMarshalErrorBefore(enc, m.Type().Key(), err) } |
