mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-19 09:48:32 -05:00
Previously we were using a mixture of old and new, with our code generation using the plugin from the old github.com/golang/protobuf library but our callers using the modern google.golang.org/protobuf . We were also using pretty ancient version of protoc. This brings us up to the current latest releases and consistently using the new Go protobuf library. There have been some notable changes to these tools in the meantime: Previously the protoc-gen-go plugin handled grpc by having its own additional level of Go-specific "plugins" of which the gRPC codegen was an example. Now the protobuf generator and the gRPC generator are separate plugins handled directly by protoc, which means the command line arguments are a different shape and the gRPC stubs get generated in a separate file from the main protobuf messages, rather than all being in one .pb.go file as before.The results are otherwise similar, though. The grpc codegen now also defaults to requiring that implementations embed the generated "unimplemented" server, which is an implementation of each service where the methods just immediately return the "unimplemented" error. This is not super important for us because we maintain the generated interfaces and their implementations together in the same repository anyway, but adding the "unimplemented" server embeds was not a big change and so seems better to follow the prevailing convention. Using these new versions means that we could in principle now switch to using protobuf edition 2024 and the new "sealed" style for Go code generation, but this commit does not include any such changes and focuses only on getting things upgraded with as few other changes as possible. We can discuss using different codegen style later and deal with that in separate commits. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>