protogen golang - finding source line for diagnostics?

24 views
Skip to first unread message

Steve Simon

unread,
Nov 3, 2022, 6:07:37 AM11/3/22
to Protocol Buffers
Hi,

I am using protogen for go successfully. We are using 
extend google.protobuf.ServiceOptions {  as we need to
encode extra fields for our backend.

When I find typos in the serviceOptions I am parsing I would like to generate diagnostics which reference the source proto file and line number.

I have not found any way to extract the source line number for an object (Service record in my case). Is it possible?

-Steve

Adam Cozzette

unread,
Nov 3, 2022, 11:35:29 AM11/3/22
to Steve Simon, Protocol Buffers
Things like comments and line numbers from the .proto file are represented in the SourceCodeInfo message here. Unfortunately I'm not familiar enough with Go protos or protogen to say exactly how to get ahold of that, but this Location type looks promising.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/e5e894ff-fba1-4889-9445-12a629d19907n%40googlegroups.com.

Steve Simon

unread,
Nov 7, 2022, 10:55:53 AM11/7/22
to Protocol Buffers
great,

that is the push in the right direction I needed.
all sorted now.

-Steve
Reply all
Reply to author
Forward
0 new messages