go-snaps icon indicating copy to clipboard operation
go-snaps copied to clipboard

[Feature Request]: MatchProto

Open tagptroll1 opened this issue 1 year ago • 1 comments

🚀 Feature Proposal

A matching function for protobuf models. There are plenty of ways to format any proto structs to string, or pass the type to the function as an option

Motivation

Proto is a very common data transport form in go. Having the ease of matching proto structs / binaries directly would significantly increase test writing productivity

Example

msg := kafkaMock.Next()
MatchProto(msg.Value)
// Or typed
MatchProto[ProtoStruct](msg.Value)

tagptroll1 avatar Nov 24 '24 11:11 tagptroll1

Hey 👋 Thanks for opening this issue, I am a bit sceptical (or not entirely convinced) supporting proto as they can be quite difficult to do equality checks. If I am not mistaken they contain internal structs with pointer which can cause issues. In any case I probably will have to read/investigate further in order to support something like this. But if you have something in mind please feel free to share it.

gkampitakis avatar Jan 04 '25 19:01 gkampitakis