This commit is contained in:
Mauri de Souza Meneguzzo 2023-12-12 18:26:47 -03:00
parent c7f2166f06
commit 1d9fe39d0c
1 changed files with 4 additions and 3 deletions

View File

@ -717,9 +717,10 @@ defer func() {
<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 element type, one had to use
<code>reflect.TypeOf((*T)(nil)).Elem()</code>, this can now be written quite
nicely with <code>reflect.TypeFor[T]()</code>.
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 -->