Skip to content

Commit d76187f

Browse files
authored
Refactor to use reflect.TypeFor (#6428)
1 parent 8194fab commit d76187f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/js/gojs/gojs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func wrapModuleFunc(runtime *goja.Runtime, fn interface{}) interface{} {
5959
}
6060

6161
// Only wrap if first parameter is context.Context
62-
if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeOf((*context.Context)(nil)).Elem() {
62+
if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeFor[context.Context]() {
6363
return fn // Return original function unchanged if it doesn't have context.Context as first arg
6464
}
6565

pkg/js/gojs/set.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func wrapWithContext(runtime *goja.Runtime, fn interface{}) interface{} {
3434
}
3535

3636
// Only wrap if first parameter is context.Context
37-
if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeOf((*context.Context)(nil)).Elem() {
37+
if fnType.NumIn() == 0 || fnType.In(0) != reflect.TypeFor[context.Context]() {
3838
return fn // Return original function unchanged if it doesn't have context.Context as first arg
3939
}
4040

0 commit comments

Comments
 (0)