diff options
| author | Joe Tsai <joetsai@digital-static.net> | 2026-01-08 17:27:59 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-01-22 07:31:33 -0800 |
| commit | 0152075d5aba0f198ac67fb426a0fc4c16e2b363 (patch) | |
| tree | f4f3462a1d9e68939217e4f6a6189a106fdc61b0 /src/encoding/json | |
| parent | a53589662719d0186e3ce3b965c082b829d0ce4c (diff) | |
| download | go-0152075d5aba0f198ac67fb426a0fc4c16e2b363.tar.xz | |
encoding/json/v2: remove issue reference in Duration formatting error
The json/v2 working group decided to commit to no default representation
for time.Duration for the foreseeable future.
Thus, we can remove the issue reference in the error message.
If JavaScript (TC39) formally adopts the Temporal.Duration type,
which uses ISO 8601 as the JSON representation for a duration,
we may consider changing the default.
Switching from no default to some default in the future
is generally a compatible change.
Updates #71631
Change-Id: I6f71a0fa97dcefba56aab0c0ddf445d9d38f6e58
Reviewed-on: https://go-review.googlesource.com/c/go/+/735080
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/encoding/json')
| -rw-r--r-- | src/encoding/json/v2/arshal_time.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/encoding/json/v2/arshal_time.go b/src/encoding/json/v2/arshal_time.go index 027503734e..615f5c91f4 100644 --- a/src/encoding/json/v2/arshal_time.go +++ b/src/encoding/json/v2/arshal_time.go @@ -54,7 +54,7 @@ func makeTimeArshaler(fncs *arshaler, t reflect.Type) *arshaler { return marshalNano(enc, va, mo) } else { // TODO(https://go.dev/issue/71631): Decide on default duration representation. - return newMarshalErrorBefore(enc, t, errors.New("no default representation (see https://go.dev/issue/71631); specify an explicit format")) + return newMarshalErrorBefore(enc, t, errors.New("no default representation; specify an explicit format")) } m.td, _ = reflect.TypeAssert[time.Duration](va.Value) @@ -79,7 +79,7 @@ func makeTimeArshaler(fncs *arshaler, t reflect.Type) *arshaler { return unmarshalNano(dec, va, uo) } else { // TODO(https://go.dev/issue/71631): Decide on default duration representation. - return newUnmarshalErrorBeforeWithSkipping(dec, t, errors.New("no default representation (see https://go.dev/issue/71631); specify an explicit format")) + return newUnmarshalErrorBeforeWithSkipping(dec, t, errors.New("no default representation; specify an explicit format")) } stringify := !u.isNumeric() || xd.Tokens.Last.NeedObjectName() || uo.Flags.Get(jsonflags.StringifyNumbers) |
