diff options
author | Mauri de Souza Meneguzzo <mauri870@gmail.com> | 2023-12-12 21:32:10 +0000 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-12-13 00:46:41 +0000 |
commit | 7cac742f1769f92313eac2188088c36d4aae1b74 (patch) | |
tree | 8352f8ec24c69308af5fe7bb71d2f4f3584b72a1 | |
parent | 400e24a8be852e7b20eb4af1999b28c20bb4ea21 (diff) | |
download | go-7cac742f1769f92313eac2188088c36d4aae1b74.tar.gz go-7cac742f1769f92313eac2188088c36d4aae1b74.zip |
doc/go1.22: document reflect.TypeFor
Change-Id: I122a3422f541f66d9f6e644a9f287f0e5a5729d2
GitHub-Last-Rev: 1d9fe39d0c1221d7179476383f3d503e45daa051
GitHub-Pull-Request: golang/go#64688
Reviewed-on: https://go-review.googlesource.com/c/go/+/549295
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
-rw-r--r-- | doc/go1.22.html | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/doc/go1.22.html b/doc/go1.22.html index 9cea5ba8c2..1ac0e7e6ee 100644 --- a/doc/go1.22.html +++ b/doc/go1.22.html @@ -728,8 +728,13 @@ defer func() { in favor of <a href="/pkg/reflect/#PointerTo"><code>PointerTo</code></a>. </p> - <p><!-- https://go.dev/issue/60088 --> - TODO: <a href="https://go.dev/issue/60088">https://go.dev/issue/60088</a>: reflect: add TypeFor + <p><!-- https://go.dev/issue/60088, CL 513478 --> + The new function <a href="/pkg/reflect/#TypeFor"><code>TypeFor</code></a> + returns the <a href="/pkg/reflect/#Type"><code>Type</code></a> that represents + the type argument T. + Previously, to get the <code>reflect.Type</code> value for a type, one had to use + <code>reflect.TypeOf((*T)(nil)).Elem()</code>. + This may now be written as <code>reflect.TypeFor[T]()</code>. </p> </dd> </dl><!-- reflect --> |