idodod / protoc-gen-fieldmask

A protoc plugin that generates fieldmask paths
MIT License
23 stars 3 forks source link

There is no check for reserved words in Golang #2

Open andrey308 opened 2 years ago

andrey308 commented 2 years ago

For example if you will try to generate field mask from such proto file:

syntax = "proto3";

option go_package = "unparsable";

package unparsable;

message Foo {
  string type = 1;
  string switch = 2;
}

You will get an error: --fieldmask_out: t.pb.fieldmask.go: unparsable Go source: 41:64: expected selector or type assertion, found 'type' (and 4 more errors)

So the problem is that if you use as a field name reserved word in Goland - it will be an error.

idodod commented 2 years ago

Hi @andrey308 , Thanks raising this issue, I will look into it.

andrey308 commented 2 years ago

fixed in my repo - https://github.com/andrey308/protoc-gen-fieldmask