Skip to content

Commit c200097

Browse files
committed
add a comment for argumentType.NumMethod() == 0
1 parent 3c7d561 commit c200097

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lambda/handler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,12 @@ func handlerTakesContext(handler reflect.Type) (bool, error) {
110110
if argumentType.Kind() != reflect.Interface {
111111
return false, nil
112112
}
113+
114+
// handlers like func(event any) are valid.
113115
if argumentType.NumMethod() == 0 {
114116
return false, nil
115117
}
118+
116119
if !contextType.Implements(argumentType) || !argumentType.Implements(contextType) {
117120
return false, fmt.Errorf("handler takes an interface, but it is not context.Context: %q", argumentType.Name())
118121
}

0 commit comments

Comments
 (0)