mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
use reflect.TypeFor instead of kludgy reflect.TypeOf
TypeFor was introduced in go1.22, which we already require.
This commit is contained in:
parent
afb182cb14
commit
96a3ecd52c
2 changed files with 2 additions and 2 deletions
2
main.go
2
main.go
|
@ -2856,7 +2856,7 @@ func cmdWebapi(c *cmd) {
|
||||||
c.Usage()
|
c.Usage()
|
||||||
}
|
}
|
||||||
|
|
||||||
t := reflect.TypeOf((*webapi.Methods)(nil)).Elem()
|
t := reflect.TypeFor[webapi.Methods]()
|
||||||
methods := map[string]reflect.Type{}
|
methods := map[string]reflect.Type{}
|
||||||
var ml []string
|
var ml []string
|
||||||
for i := 0; i < t.NumMethod(); i++ {
|
for i := 0; i < t.NumMethod(); i++ {
|
||||||
|
|
|
@ -199,7 +199,7 @@ var docsIndex []byte
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var methods []string
|
var methods []string
|
||||||
mt := reflect.TypeOf((*webapi.Methods)(nil)).Elem()
|
mt := reflect.TypeFor[webapi.Methods]()
|
||||||
n := mt.NumMethod()
|
n := mt.NumMethod()
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
methods = append(methods, mt.Method(i).Name)
|
methods = append(methods, mt.Method(i).Name)
|
||||||
|
|
Loading…
Reference in a new issue