mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
all: use reflect.TypeFor now available in Go 1.22 (#11078)
Updates #cleanup Signed-off-by: Joe Tsai <joetsai@digital-static.net>
This commit is contained in:
@@ -26,7 +26,7 @@ func TestConfigEqual(t *testing.T) {
|
||||
"SubnetRoutes", "SNATSubnetRoutes", "NetfilterMode",
|
||||
"NetfilterKind",
|
||||
}
|
||||
configType := reflect.TypeOf(Config{})
|
||||
configType := reflect.TypeFor[Config]()
|
||||
configFields := []string{}
|
||||
for i := 0; i < configType.NumField(); i++ {
|
||||
configFields = append(configFields, configType.Field(i).Name)
|
||||
|
@@ -20,7 +20,7 @@ var (
|
||||
)
|
||||
|
||||
func getPeerStatsOffset(name string) uintptr {
|
||||
peerType := reflect.TypeOf(device.Peer{})
|
||||
peerType := reflect.TypeFor[device.Peer]()
|
||||
field, ok := peerType.FieldByName(name)
|
||||
if !ok {
|
||||
panic("no " + name + " field in device.Peer")
|
||||
|
Reference in New Issue
Block a user