Skip to content

Commit

Permalink
Add comment re: sorting and binary search
Browse files Browse the repository at this point in the history
Signed-off-by: Akshay Shah <akshay@akshayshah.org>
  • Loading branch information
akshayjshah committed May 27, 2024
1 parent b6e9cd4 commit 21bacae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions interceptors/protovalidate/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func WithIgnoreMessages(msgs ...protoreflect.MessageType) Option {
}

func (o *options) shouldIgnoreMessage(fqn protoreflect.FullName) bool {
// Names are sorted in WithIgnoreMessages, so we can use binary search.
_, found := slices.BinarySearch(o.ignoreMessages, fqn)
return found
}

0 comments on commit 21bacae

Please sign in to comment.