Things like comments and line numbers from the .proto file are represented
in the SourceCodeInfo message here
<https://github.com/protocolbuffers/protobuf/blob/88d8f6001d4b14520488f23de36366b7df673373/src/google/protobuf/descriptor.proto#L754>.
Unfortunately I'm not familiar enough with Go protos or protogen to say
exactly how to get ahold of that, but this Location
<https://pkg.go.dev/google.golang.org/protobuf/compiler/protogen#Location>
type looks promising.

On Thu, Nov 3, 2022 at 3:07 AM Steve Simon <[email protected]> wrote:

> 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
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/e5e894ff-fba1-4889-9445-12a629d19907n%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/e5e894ff-fba1-4889-9445-12a629d19907n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr6FHekuf5%3D4CH5a97ZsoLTczrmJMjzvQRr%2BHk-wAhB2BQ%40mail.gmail.com.

Reply via email to