From: Joe Tsai Date: Fri, 9 Jan 2026 01:27:59 +0000 (-0800) Subject: encoding/json/v2: remove issue reference in Duration formatting error X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0152075d5aba0f198ac67fb426a0fc4c16e2b363;p=gostls13.git 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 Reviewed-by: Damien Neil Auto-Submit: Joseph Tsai LUCI-TryBot-Result: Go LUCI --- 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)