From 48c88f1b1bac1ef4fc81246a7f31933f8f922706 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 14 Jul 2021 14:46:09 -0700 Subject: reflect: add Value.CanConvert For #395 For #46746 Change-Id: I4bfc094cf1cecd27ce48e31f92384cf470f371a6 Reviewed-on: https://go-review.googlesource.com/c/go/+/334669 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Go Bot Reviewed-by: Keith Randall Reviewed-by: Joe Tsai --- doc/go1.17.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'doc') diff --git a/doc/go1.17.html b/doc/go1.17.html index b31006fe65..7739d1c62e 100644 --- a/doc/go1.17.html +++ b/doc/go1.17.html @@ -989,6 +989,18 @@ func Foo() bool {
reflect
+

+ The new + Value.CanConvert + method reports whether a value can be converted to a type. + This may be used to avoid a panic when converting a slice to an + array pointer type if the slice is too short. + Previously it was sufficient to use + Type.ConvertibleTo + for this, but the newly permitted conversion from slice to array + pointer type can panic even if the types are convertible. +

+

The new StructField.IsExported -- cgit v1.2.3-54-g00ecf