From 52fc18eb77e96b99a35e07030b01ad140d811fb3 Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Wed, 27 Aug 2025 17:00:46 +0800 Subject: [PATCH] Refactor to use reflect.TypeFor --- pkg/js/gojs/gojs.go | 2 +- pkg/js/gojs/set.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/js/gojs/gojs.go b/pkg/js/gojs/gojs.go index e82dcb6f3c..f24413efbf 100644 --- a/pkg/js/gojs/gojs.go +++ b/pkg/js/gojs/gojs.go @@ -59,7 +59,7 @@ func wrapModuleFunc(runtime *goja.Runtime, fn interface{}) interface{} { } // Only wrap if first parameter is context.Context - if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeOf((*context.Context)(nil)).Elem() { + if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeFor[context.Context]() { return fn // Return original function unchanged if it doesn't have context.Context as first arg } diff --git a/pkg/js/gojs/set.go b/pkg/js/gojs/set.go index 4d4407deff..aa1afd79b4 100644 --- a/pkg/js/gojs/set.go +++ b/pkg/js/gojs/set.go @@ -34,7 +34,7 @@ func wrapWithContext(runtime *goja.Runtime, fn interface{}) interface{} { } // Only wrap if first parameter is context.Context - if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeOf((*context.Context)(nil)).Elem() { + if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeFor[context.Context]() { return fn // Return original function unchanged if it doesn't have context.Context as first arg }