protoc-gen-go-grpcmockGoogle protocol buffer compiler plugin to generate Mocks for gRPC Services in Go.
Installation
Download the latest version from the Release Page. Extract the archive and make sure, the protoc-gen-go-grpcmock
binary can be found in your PATH
.
For instance:
$ VERSION=$(curl -fsSL https://github.com/lovoo/protoc-gen-go-grpcmock/releases/latest -H "Accept: application/json" | jq -r .tag_name)
$ curl -fsSL "https://github.com/lovoo/protoc-gen-go-grpcmock/releases/download/${VERSION}/protoc-gen-go-grpcmock_${VERSION:1}_$(uname -s)_$(uname -m).tar.gz" | tar -xzC /usr/local/bin protoc-gen-go-grpcmock
Or build the protoc-gen-go-grpcmock
binary from source (requires Go 1.18+).
$ git clone https://github.com/lovoo/protoc-gen-go-grpcmock && cd protoc-gen-go-grpcmock
$ go build -ldflags "-X main.Version=$(git describe --tags)" cmd/protoc-gen-go-grpcmock
Usage
Generate code by specifying the --go-grpcmock_out
(and optional --go-grpcmock_opt
) argument when invoking the protoc
compiler.
$ protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
--go-grpcmock_out=. --go-grpcmock_opt=paths=source_relative \
examples/helloworld/helloworld.proto
This will generate a *_grpc_mock.pb
file for each specified .proto
file, containing:
- Generated Client and Server Mocks for each Service
- Matchers for all Messages
Options
The following parameters can be provided to change the behaviour of the compiler plugin.
Parameter | Default | Available Options | Description |
---|---|---|---|
framework |
"testify" | "testify", "pegomock" | The mocking framework to use. |
import_package |
false | true/false | Import the file's Go package. This can be useful if mocks should be generated in a different package, then the original .pb.go files |
Examples
Examples can be found in the examples directory.
License
The MIT License (MIT). Please see LICENSE for more information.
Bump goreleaser/goreleaser-action from 3 to 4
Bumps goreleaser/goreleaser-action from 3 to 4.
Release notes
Sourced from goreleaser/goreleaser-action's releases.
Commits
8f67e59
chore: regenerate78df308
chore(deps): bump minimatch from 3.0.4 to 3.1.2 (#383)66134d9
Merge remote-tracking branch 'origin/master' into flarco/master3c08cfd
chore(deps): bump yargs from 17.6.0 to 17.6.25dc579b
docs: add example when using workdir along with upload-artifact (#366)3b7d1ba
feat!: remove auto-snapshot on dirty tag (#382)23e0ed5
fix: do not override GORELEASER_CURRENT_TAG (#370)1315dab
update buildb60ea88
improve install4d25ab4
Update goreleaser.tsDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump google.golang.org/grpc from 1.50.1 to 1.51.0
Bumps google.golang.org/grpc from 1.50.1 to 1.51.0.
Release notes
Sourced from google.golang.org/grpc's releases.
Commits
eeb9afa
Change version to 1.51.0 (#5782)72812fe
gcp/observability: filter logging from cloud ops endpoints calls (#5765)0ae33e6
xdsclient: remove unused test code (#5772)824f449
go.mod: upgrade x/text to v0.4 to address CVE (#5769)7f23df0
xdsclient: switch xdsclient watch deadlock test to e2e style (#5697)32f969e
o11y: Added started rpc metric in o11y plugin (#5768)b597a8e
xdsclient: improve authority watchers test (#5700)e41e894
orca: create ORCA producer for LB policies to use to receive OOB load reports...36d14db
Fix binary logging bug which logs a server header on a trailers only response...fcb8bdf
xds/google-c2p: validate url for no authorities (#5756)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump github.com/stretchr/testify from 1.8.0 to 1.8.1
Bumps github.com/stretchr/testify from 1.8.0 to 1.8.1.
Commits
b747d7c
Bump github.com/stretchr/objx from 0.4.0 to 0.5.0 (#1283)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump google.golang.org/grpc from 1.50.0 to 1.50.1
Bumps google.golang.org/grpc from 1.50.0 to 1.50.1.
Release notes
Sourced from google.golang.org/grpc's releases.
Commits
4c776ec
Cherry-pick observability changes from master to v1.50.x and update version t...6576007
Change version to 1.50.1-dev (#5686)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump google.golang.org/grpc from 1.49.0 to 1.50.0
Bumps google.golang.org/grpc from 1.49.0 to 1.50.0.
Release notes
Sourced from google.golang.org/grpc's releases.
Commits
c1d7d7a
Change version to 1.50.0 (#5685)1451c62
internal/transport: optimize grpc-message encoding/decoding (#5654)be4b63b
test: minor test cleanup (#5679)d83070e
Changed Outlier Detection Env Var to default true (#5673)54521b2
client: remove trailing null from unix abstract socket address (#5678)36e4810
orca: cleanup old code, and get grpc package to use new code (#5627)e8866a8
build: harden GitHub Workflow permissions (#5660)8458251
xdsclient: ignore routes with cluster_specifier_plugin when GRPC_EXPERIMENTAL...a238ceb
xDS: Outlier Detection Env Var not hardcoded to false (#5664)b1d7f56
transport: Fix deadlock in transport caused by GOAWAY race with new stream cr...Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump google.golang.org/grpc from 1.48.0 to 1.49.0
Bumps google.golang.org/grpc from 1.48.0 to 1.49.0.
Release notes
Sourced from google.golang.org/grpc's releases.
Commits
1c29e07
Change version to 1.49.0 (#5583)8e5a84e
xds/resolver: generate channel ID randomly (#5603)92cee34
gcp/observability: Add logging filters for logging, tracing, and metrics API ...c7fe135
O11Y: Added support for custom tags (#5565)7981af4
test/kokoro: add missing image tagging to the xDS interop url map buildscript...6f34b7a
xdsclient: NACK endpoint resource if load_balancing_weight is specified and i...f9409d3
ringhash: handle config updates properly (#5557)946dde0
xdsclient: NACK endpoint resources with zero weight (#5560)b89f49b
xdsclient: deflake Test/LDSWatch_PartialValid (#5552)9bc72de
grpc: remove mentions of WithBalancerName from comments (#5555)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump google.golang.org/protobuf from 1.28.0 to 1.28.1
Bumps google.golang.org/protobuf from 1.28.0 to 1.28.1.
Release notes
Sourced from google.golang.org/protobuf's releases.
Commits
6875c3d
all: release v1.28.1881da6e
all: Add prebuild binaries for arm642a74a0e
A+C: delete AUTHORS and CONTRIBUTORSde9682a
internal/impl: improve MessageInfo.New performanceb0a9446
all: reformat with go1.19 gofmtc1bbc5d
all: make integration test work on darwin/arm645f429f7
proto: fix compilation failure in testsfc44d00
proto: use reflect.Ptr for backward compatibility380c339
proto: short-circuit Equal when inputs are identical784c482
all: remove shorthand import aliasesDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump google.golang.org/grpc from 1.47.0 to 1.48.0
Bumps google.golang.org/grpc from 1.47.0 to 1.48.0.
Release notes
Sourced from google.golang.org/grpc's releases.
Commits
6417495
Change version to 1.48.0 (#5482)5770b1d
xds: drop localities with zero weight at the xdsClient layer (#5476)423cd8e
interop: update proto to make vet happy (#5475)c9b16c8
transport: remove unusedbufWriter.onFlush()
(#5464)755bf5a
fix typo in the binary log (#5467)15739b5
health: split imports into healthpb and healthgrpc (#5466)c075d20
interop client: provide new flag, --soak_min_time_ms_between_rpcs (#5421)4b75005
clusterresolver: merge P(p)arseConfig functions (#5462)d883f3d
test/xds: fail only when state changes to something other than READY and IDLE...c6ee1c7
xdsclient: only include nodeID in error strings, not the whole nodeProto (#5461)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump github.com/stretchr/testify from 1.7.5 to 1.8.0
Bumps github.com/stretchr/testify from 1.7.5 to 1.8.0.
Commits
181cea6
impr:CallerInfo
should print full paths to the terminal (#1201)cf1284f
Allow mock expectations to be ordered (#1106)66eef0e
fix: assert.MapSubset (or just support maps in assert.Subset) (#1178)2fab6df
Add WithinTimeRange method (#1188)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump github.com/stretchr/testify from 1.7.3 to 1.7.5
Bumps github.com/stretchr/testify from 1.7.3 to 1.7.5.
Commits
b5ce165
fixing panic in calls to assertion with nil m.mutex (#1212)c206b2e
Mock can be deadlocked by a panic (#1157)1b73601
suite: correctly set stats on test panic (#1195)ba1076d
Add .Unset method to mock (#982)c31ea03
Support comparing byte slice (#1202)48391ba
Fix panic in AssertExpectations for mocks without expectations (#1207)840cb80
arrays value types in a zero-initialized state are considered empty (#1126)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)Bump github.com/stretchr/testify from 1.7.2 to 1.7.3
Bumps github.com/stretchr/testify from 1.7.2 to 1.7.3.
Commits
07dc7ee
Bump actions/setup-go from 3.1.0 to 3.2.0 (#1191)c33fc8d
Bump actions/checkout from 2 to 3 (#1163)3c33e07
Added Go 1.18.1 as a build/supported version (#1182)e2b56b3
Bump github.com/stretchr/objx from 0.1.0 to 0.4.0Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)