github.com/klaytn/klaytn@v1.12.1/networks/grpc/README.md (about)

     1  # How to generate `klaytn.pb.go` from `klaytn.proto`
     2  
     3  ## 1. Install protobuf for Go
     4  ```
     5  $ go get -u github.com/golang/protobuf/protoc-gen-go
     6  ```
     7  
     8  ## 2. Generate a Go file from protobuf IDL
     9  ```
    10  $ protoc -I=. --go_out=plugins=grpc:. klaytn.proto
    11  ```
    12  
    13  ## 3. Change the generated file
    14  
    15  Because of version mismatch issue, we need to change
    16  `proto.ProtoPackageIsVersion3` in the generated file `klaytn.pb.go` to
    17  `proto.ProtoPackageIsVersion2`.
    18  
    19  ```
    20  $ sed -i -e 's/ProtoPackageIsVersion3/ProtoPackageIsVersion2/g' klaytn.pb.go
    21  ```