Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sorcererxw committed Jul 23, 2022
1 parent 8809e47 commit 83631c4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 78 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.PHONY: build
.PHONY: build gen_example
build:
go build -o build/ .
go build -o build/ .

gen_example:
cd example && buf generate .
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ generated `petstore_grpc.pb.go`.
#### gomock

```shell
hyperfine "mockgen -source=petstore_grpc.pb.go -destination=petstore_grpc_mock.pb.go"
hyperfine "mockgen -source=petstore_grpc.pb.go -destination=mock/petstore_grpc_mock.pb.go"
```

```
Expand All @@ -46,7 +46,7 @@ Benchmark #1: protoc --go-grpc-mock_out=. petstore.proto
## Installation

```
go install github.com/sorcererxw/protoc-gen-go-grpc-mock
go install github.com/sorcererxw/protoc-gen-go-grpc-mock@latest
```

Also required:
Expand Down
2 changes: 1 addition & 1 deletion example/another.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/petstore.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions example/petstore_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 20 additions & 68 deletions example/petstore_grpc_mock.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions mockgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPac
g.p("")
}

g.p("// Code generated by MockGen. DO NOT EDIT.")
g.p("// Code generated by protoc-gen-go-grpc-mock. DO NOT EDIT.")
if g.filename != "" {
g.p("// Source: %v", g.filename)
g.p("// source: %v", g.filename)
} else {
g.p("// Source: %v (interfaces: %v)", g.srcPackage, g.srcInterfaces)
g.p("// source: %v (interfaces: %v)", g.srcPackage, g.srcInterfaces)
}
g.p("")

Expand Down Expand Up @@ -145,7 +145,6 @@ func (g *generator) Generate(pkg *model.Package, outputPkgName string, outputPac
localNames[pkgName] = true
}

g.p("// Package %v is a generated GoMock package.", outputPkgName)
g.p("package %v", outputPkgName)
g.p("")
g.p("import (")
Expand Down

0 comments on commit 83631c4

Please sign in to comment.