diff --git a/internal/extension/extension.go b/internal/extension/extension.go index e56413a..f0ccb50 100644 --- a/internal/extension/extension.go +++ b/internal/extension/extension.go @@ -184,7 +184,7 @@ func (em *ExtensionManager) SendEndInvocationRequest(ctx context.Context, functi } } fmt.Printf("[DEBUG lambda] extension.go context: ") - dumpContext(ctx) + dumpContextValue(ctx) resp, err := em.httpClient.Do(req) if err != nil || resp.StatusCode != 200 { @@ -192,31 +192,12 @@ func (em *ExtensionManager) SendEndInvocationRequest(ctx context.Context, functi } } -func dumpContext(ctx context.Context) { - val := reflect.ValueOf(ctx) - typ := reflect.TypeOf(ctx) - - // If it's a pointer, get the underlying element - if val.Kind() == reflect.Ptr { - val = val.Elem() - typ = typ.Elem() - } - - if typ.Kind() == reflect.Struct { - for i := 0; i < val.NumField(); i++ { - field := val.Field(i) - fieldType := typ.Field(i) - - // Just print the field name and type, since we can't safely access unexported fields - fmt.Printf("Field: %s, Type: %v\n", fieldType.Name, fieldType.Type) - - // If this field is itself a context, recurse into it - if field.Type().Implements(reflect.TypeOf((*context.Context)(nil)).Elem()) { - if !field.IsNil() { - fmt.Printf("Nested context in %s:\n", fieldType.Name) - dumpContext(field.Interface().(context.Context)) - } - } +func dumpContextValue(ctx context.Context) { + val := reflect.ValueOf(ctx).Elem() + for i := 0; i < val.NumField(); i++ { + field := val.Field(i) + if field.Kind() == reflect.Interface && !field.IsNil() { + fmt.Printf("Key type: %T\n", field.Interface()) } } }