| || _ | | || || || || | | | | || | || | _ || || || || || | | | __ | ||| | || || || | __ | | | | | || || __ || || || || || || _ | | || || | | || | | | | || || | | | | | |||| |||| |||||___||| |__|
gRPCGen is a simple program for generating test from gRPC code generated by protobufs. gRPCGen will create code for both connecting to a gRPC service, and code for testing its various methods.
gRPCGen expects goimports. Install both using
go install golang.org/x/tools/cmd/goimports
go install github.com/yummydev/grpcgen
- Create a new package where all test code will reside
- Modify the template below with your code.
package sds
import (
"github.com/pizzahutdigital/protobufs/store"
)
//go:generate grpcgen run --package . --target Client
var Client storedata.StoreDataClient
where the target ("Client" in this case), is the interface type to generate code for. 3. cd to the directory and run go:generate (replace --package . with the import path to run go:generate from anywhere)
Usage: grpcgen [command]
Available Commands: help Help about any command run Run Test Generation
Flags: -h, --help help for grpcgen --package string path (import path or relative) to the package --target string name of the global variable that should serve as the client for test
Use "grpcgen [command] --help" for more information about a command.