]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/json/v2: remove issue reference in Duration formatting error
authorJoe Tsai <joetsai@digital-static.net>
Fri, 9 Jan 2026 01:27:59 +0000 (17:27 -0800)
committerGopher Robot <gobot@golang.org>
Thu, 22 Jan 2026 15:31:33 +0000 (07:31 -0800)
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>

src/encoding/json/v2/arshal_time.go

index 027503734e783e3c3dede92178d84d1e0d614b94..615f5c91f44b39bf666ccf87d72d8936c8f9477f 100644 (file)
@@ -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)