protoc-gen-go-mock

January 11, 2024 ยท View on GitHub

Go Reference Go Report Card

This tool generates Go language bindings of services in protobuf definition files for mocking gRPC.

Installation

go install github.com/kw510/protoc-gen-go-mock@latest

Also required:

Usage

With protoc

go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
protoc --go_out=.examples \
       --go-grpc_out=.examples \
       --go-mock_out=.examples \
       .examples/petstore.proto

Building locally

mkdir .build
export PATH=$PATH:$(pwd)/.build
go build -o ./.build