I had some difficulty locating a bug in a .proto file which was caused parsing to fail, but where our other tools (using protoc) were successfully generating the Go protobuf files, as the error message wasn't clear to me (as an infrequent user).
I was receiving this error message:
invalid MessageBody type &{<nil>} of &{<nil>}
But it was unclear to me which Message (in a fairly long proto file) was the source of this. Inevitably it was due to a typo with an extra semicolon at the end of one of the field definitions:
repeated string fields = 3 ;;
Could we perhaps wrap the error when interpreting Enums, Messages, and Services, with their name so it's easier to find the source of the error? This uses the error wrapping introduced in Go 1.13, so that the original error can still be retrieved via Unwrap() and examined with Is and As. Very happy to change this if there's a preferred alternative!
I had some difficulty locating a bug in a
.proto
file which was caused parsing to fail, but where our other tools (using protoc) were successfully generating the Go protobuf files, as the error message wasn't clear to me (as an infrequent user).I was receiving this error message:
But it was unclear to me which Message (in a fairly long proto file) was the source of this. Inevitably it was due to a typo with an extra semicolon at the end of one of the field definitions:
Could we perhaps wrap the error when interpreting Enums, Messages, and Services, with their name so it's easier to find the source of the error? This uses the error wrapping introduced in Go 1.13, so that the original error can still be retrieved via
Unwrap()
and examined with Is and As. Very happy to change this if there's a preferred alternative!