Skip to content

Commit 3b088a0

Browse files
committed
Add note about only v2 API
1 parent 31d53ae commit 3b088a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/status/status.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ func (s *Status) Details() []any {
186186
// that the type is wrapped in a MessageV1 wrapper again before
187187
// returning. Note that protoc-gen-go doesn't generate code which
188188
// implements ONLY MessageV2 at the time of writing.
189+
//
190+
// NOTE: Status details can also be added using the FromProto method.
191+
// This could theoretically allow passing a Detail message that only
192+
// implements the V2 API. In such a case the message will be wrapped in
193+
// a MessageV1 wrapper when fetched using Details().
194+
// Since protoc-gen-go generates only code that implements both V1 and
195+
// V2 APIs for backward compatibility, this is not a concern.
189196
details = append(details, protoadapt.MessageV1Of(detail))
190197
}
191198
return details

0 commit comments

Comments
 (0)