Skip to content

Commit

Permalink
Adapt usage instructions to use protoc-gen-go-grpc
Browse files Browse the repository at this point in the history
This reflect recent changes in https://grpc.io/docs/languages/go/quickstart/
to use new protoc-gen-go-grpc.

Also remove a duplicated paragraph.
  • Loading branch information
olivierlemasle committed Oct 14, 2020
1 parent 1aab03c commit 02ea2e1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ to track the versions of the following executable packages:
package tools

import (
_ "github.com/golang/protobuf/protoc-gen-go"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
_ "github.com/golang/protobuf/protoc-gen-go"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
)
```

Expand All @@ -72,14 +73,16 @@ Run `go mod tidy` to resolve the versions. Install by running
$ go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
github.com/golang/protobuf/protoc-gen-go
github.com/golang/protobuf/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
```

This will place three binaries in your `$GOBIN`;
This will place four binaries in your `$GOBIN`;

* `protoc-gen-grpc-gateway`
* `protoc-gen-openapiv2`
* `protoc-gen-go`
* `protoc-gen-go-grpc`

Make sure that your `$GOBIN` is in your `$PATH`.

Expand Down Expand Up @@ -108,7 +111,10 @@ Make sure that your `$GOBIN` is in your `$PATH`.
Here's an example of what a `protoc` command might look like to generate Go stubs:

```sh
protoc -I . --go_out ./gen/go/ --go_opt plugins=grpc --go_opt paths=source_relative your/service/v1/your_service.proto
protoc -I . \
--go_out ./gen/go/ --go_opt paths=source_relative \
--go-grpc_out ./gen/go/ --go-grpc_opt paths=source_relative \
your/service/v1/your_service.proto
```

3. Implement your service in gRPC as usual
Expand Down Expand Up @@ -178,11 +184,6 @@ Make sure that your `$GOBIN` is in your `$PATH`.
+ }
}
```
>You will need to provide the required third party protobuf files to the `protoc` compiler.
>They are included in this repo under the `third_party/googleapis` folder, and we recommend copying
>them into your `protoc` generation file structure. If you've structured your proto files according
>to something like [the Buf style guide](https://buf.build/docs/style-guide#files-and-packages),
>you could copy the files into a top-level `./google` folder.
>You will need to provide the required third party protobuf files to the `protoc` compiler.
>They are included in this repo under the `third_party/googleapis` folder, and we recommend copying
Expand Down

0 comments on commit 02ea2e1

Please sign in to comment.