false conflict: moving a single field into a new oneof
Hello!
Protobuf docs say that you can safely move a single field into a new oneof and may be able to move multiple fields if it is known that only one is ever set: https://protobuf.dev/programming-guides/proto3/#reuse
But protolock considers it a conflict
Hi!
Thanks for filing this issue. I am very tight for time these days, and am not sure I'd be able to commit to a fix, but happy to help if you or someone else wanted to pick it up.
Hey @gggrafff , I made the change https://github.com/nilslice/protolock/pull/151. I noted in the PR description that moving a single field into or out of a oneof is NOT a safe change in Go, per per https://google.aip.dev/180#moving-into-oneofs, which is referenced in the doc you linked to here:
Changing a single optional field or extension into a member of a new oneof is binary compatible, however for some languages (notably, Go) the generated code’s API will change in incompatible ways. For this reason, Google does not make such changes in its public APIs, as documented in AIP-180. With the same caveat about source-compatibility, moving multiple fields into a new oneof may be safe if you are sure that no code sets more than one at a time. Moving fields into an existing oneof is not safe. Likewise, changing a single field oneof to an optional field or extension is safe.