Skip to main content

protoc installation

Overview

protoc is a tool to generate code based on proto files that generate code in multiple languages such as C++, Java, Python, Go, PHP, etc. while gRPC code generation depends on protocol-gen-go,protocol-gen-go-grpc plugin for gRPC code generation in Go language.

You can install with goctl one click installation protocol,protocol-gen-go,protocol-gen-go-grpc related components, you can execute the following command:

$ goctl env check --install --verbose --force

For more information about goctl env instructions, refer to goctl env

2. Manual installation

2.1 Downloads

NOTE

Here we take the 21.11 version as an example, and it is not recommended to install a specific version. Developers can choose according to their needs. For more versions, go to Go to Github to choose by yourself.

Other versions and operating systems can to go to Github to choose.

2.2 Installation

Extract downloads and move them to $GOBIN directory, see $GOBIN directory:

$ go env GOPATH

GOBIN is $GOPATH/bin, if you $GOPATH do not $PATH you need to add it to $PATH.

3. Validation

Once installed, you can perform the following instructions to verify whether you have installed successfully:

$ goctl env check --verbose
[goctl-env]: preparing to check env

[goctl-env]: looking up "protoc"
[goctl-env]: "protoc" is installed

[goctl-env]: looking up "protoc-gen-go"
[goctl-env]: "protoc-gen-go" is installed

[goctl-env]: looking up "protoc-gen-go-grpc"
[goctl-env]: "protoc-gen-go-grpc" is installed

[goctl-env]: congratulations! your goctl environment is ready!