Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 2.26 KB

PROTOBUF.md

File metadata and controls

49 lines (39 loc) · 2.26 KB

Rebuilding generated protobuf code

If you make changes to .proto files, you will need to rebuild the generated Go code. You may also need to rebuild the generated code if the required versions of the google.golang.org/protobuf or google.golang.org/grpc modules defined in go.mod change.

First, follow this one-time setup:

  1. Download the protobuf compiler. The simplest approach is to download one of the prebuilt binaries (named protoc) and extract it somewhere in your machine's $PATH.

To generate the code:

  1. Navigate to this directory (pkg/beam/model).
  2. Check go.mod and make note of which versions of google.golang.org/protobuf and google.golang.org/grpc are required.
  3. Verify the versions in ../../../scripts/genproto.sh are correct
  4. go generate

Generated Go code fails to build

If the generated .pb.go code contains build errors, it indicates a version mismatch somewhere between the packages required in go.mod, the installed Go executables, and the prebuilt protoc binary (which should match the google.golang.org/protobuf version). Following the steps above with matching version numbers should fix the error.