简体   繁体   中英

When we use the google protocol buffer, could we modify the generated pb.go file?

For example, is it ok to add an interface or associate a function I created with a struct in the generated pb.go file?

The reason that I want to make these kinds of changes is it would make my code easier to implement. I am not sure if I am allowed to do this since the first commented line in the generated file says "DO NOT EDIT".

You can edit generated code as much as you want. But It's not recommended because if you compile the code again your changes will be discarded and maybe you face some unexpected bugs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM