Skip to content

Add test for proxy to make sure all payloads are visited #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cmd/proxygenerator/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ func containsMessage(
}

// checkMessage examines the given message descriptor md and, if it (transitively) contains a
// payload, appends it result slice.
// payload, appends its result slice.
func checkMessage(md protoreflect.MessageDescriptor,
targetMessages []string,
memo map[protoreflect.FullName]bool,
Expand Down Expand Up @@ -590,7 +590,7 @@ func protoFullNameToGoPackageAndType(md protoreflect.MessageDescriptor) (pkgPath
return pkgPath, typeName, nil
}

func gatherMatchesToRypeRecords(
func gatherMatchesToTypeRecords(
mds []protoreflect.MessageDescriptor,
targetTypes []types.Type,
directMatchTypes []types.Type,
Expand Down Expand Up @@ -657,6 +657,7 @@ func walk(desired []types.Type, directMatchTypes []types.Type, typ types.Type, r
record := TypeRecord{}
(*records)[typeName] = &record

// Look for all functions with this `typ` type
for _, meth := range typeutil.IntuitiveMethodSet(elemType(typ), nil) {
// Ignore non-exported methods
if !meth.Obj().Exported() {
Expand Down Expand Up @@ -766,11 +767,11 @@ func generateInterceptor(cfg config) error {
}
allFailureContainingMessages, err := gatherMessagesContainingTargets(protoFiles, failureMessageNames, excludedEntryPoints)

payloadRecords, err := gatherMatchesToRypeRecords(allPayloadContainingMessages, payloadTypes, payloadDirectMatchType)
payloadRecords, err := gatherMatchesToTypeRecords(allPayloadContainingMessages, payloadTypes, payloadDirectMatchType)
if err != nil {
return err
}
failureRecords, err := gatherMatchesToRypeRecords(allFailureContainingMessages, failureTypes, make([]types.Type, 0))
failureRecords, err := gatherMatchesToTypeRecords(allFailureContainingMessages, failureTypes, make([]types.Type, 0))
if err != nil {
return err
}
Expand Down
Loading