From d76187f99a1fb345f9bdada5d6c44ab274c1fdcc Mon Sep 17 00:00:00 2001 From: cui Date: Thu, 28 Aug 2025 01:01:04 +0800 Subject: [PATCH] Refactor to use reflect.TypeFor (#6428) --- 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 e82dcb6f3..f24413efb 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 4d4407def..aa1afd79b 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 }