Changes in Go implementation of the new protobuf and gRPC

Go Golang protobuf gRPC vscode

If you don’t know yet, there were major changes by Google in protobuf and gRPC implementation for Go. New version should be better in all means so you should switch as soon as possible, if you are already using these technologies. In this article I am going to focus on Linux variant, but the upgrade procedure should be quite similar on OSX or Windows.

In order to use protobuf compiler or generator, if you wish, you had to install protoc compiler. There are no changes in this step, you still need it although you may want to upgrade to the latest version.

Previously, in order to generate Go code you had to use protoc-gen-go plugin which you had to install using the following command:

go get

Now we have new implementation which replaces the old version and you should just run:

go get

Unfortunately, this is not all. Previously you could generate gRPC code together with protobuf without further dependencies, so it was enough to run a command similar to this:

protoc --go_out=plugins=grpc:. --go_opt=paths=source_relative some_path/example.proto

As plugin gRPC is removed from the new implementation, flag –go_out won’t work like this anymore. Instead, you have to install protoc-gen-go-grpc and you have to use the protoc the following way:

go get
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative some_path/example.proto

I f you receive some strange errors that some constants are not defined, you may want to pin, and dependencies in go.mod to the latest versions or simply delete these lines in go.mod and run go build again. Hopefully it is going to fetch the right dependencies.

Finally, you will receive errors that your implementation of the gRPC server interfaces does not implement yourpb.mustEmbedUnimplementedYourServiceServer method. You can solve this easily by embeding appropriate your_pb.UnimplementedYourServiceServer_ in your implementation. After this the code should hapilly compile. If you have trouble solving this, you may want to check the examples from the official repository.

If you use vscode editor, it is worth saying that you can install proto3 extension from the marketplace and put the following snippet in the settings.json file:

  "protoc": {
    "options": [




If you do so, you will be able to generate the files inside the editor. Happy protobuffing 🙂

Running stack of microservices using docker-compose and acim/go-reflex image

How to easily run multiple Go microservices locally using just one image
Go microservice docker-compose docker

VSCode setup for Go developers

Learn how to setup your VSCode or VSCodium for efficient development in Go
vscode vscodium go golang

Upcoming Go's generics

Find out more about upcoming generics in Go
Go Golang generics