use reflect.TypeFor instead of kludgy reflect.TypeOf

TypeFor was introduced in go1.22, which we already require.
This commit is contained in:
Mechiel Lukkien 2024-11-29 13:17:13 +01:00
parent afb182cb14
commit 96a3ecd52c
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -2856,7 +2856,7 @@ func cmdWebapi(c *cmd) {
c.Usage()
}
t := reflect.TypeOf((*webapi.Methods)(nil)).Elem()
t := reflect.TypeFor[webapi.Methods]()
methods := map[string]reflect.Type{}
var ml []string
for i := 0; i < t.NumMethod(); i++ {

View file

@ -199,7 +199,7 @@ var docsIndex []byte
func init() {
var methods []string
mt := reflect.TypeOf((*webapi.Methods)(nil)).Elem()
mt := reflect.TypeFor[webapi.Methods]()
n := mt.NumMethod()
for i := 0; i < n; i++ {
methods = append(methods, mt.Method(i).Name)