Skip to content

Commit 4259b90

Browse files
committed
Update docs to include the exported gRPC approach
1 parent 411583c commit 4259b90

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

docs/cookbook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,5 +327,5 @@ package generate
327327

328328
//go:generate go run entc.go
329329
//go:generate go run github.com/99designs/gqlgen
330-
//go:generate sh -c "protoc --experimental_allow_proto3_optional --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --proto_path=../internal/transport-inbound/grpc/proto --go_out=../internal/generated/grpc/ --go-grpc_out=../internal/generated/grpc/ ../internal/transport-inbound/grpc/proto/*.proto"
330+
//go:generate sh -c "protoc --experimental_allow_proto3_optional --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --proto_path=../transport-inbound/grpc/proto --go_out=../../pkg/grpc/ --go-grpc_out=../../pkg/grpc/ ../transport-inbound/grpc/proto/*.proto"
331331
```

docs/modules/grpc.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Install the prerequisites listed in [gRPC Go - Quick Start](https://grpc.io/docs
99
Add the following code to `cmd/generate/generate.go`:
1010

1111
```
12-
//go:generate sh -c "protoc --experimental_allow_proto3_optional --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --proto_path=../transport-inbound/grpc/proto/ --go_out=./grpc/ --go-grpc_out=./grpc/ ../transport-inbound/grpc/proto/*.proto"
12+
//go:generate sh -c "protoc --experimental_allow_proto3_optional --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --proto_path=../transport-inbound/grpc/proto --go_out=../../pkg/grpc/ --go-grpc_out=../../pkg/grpc/ ../transport-inbound/grpc/proto/*.proto"
1313
```
1414

1515
In `main.go`:
@@ -74,7 +74,7 @@ import (
7474

7575
"github.com/example/package/v3/internal/features/commands"
7676
"github.com/example/package/internal/features/queries"
77-
pb "github.com/example/package/internal/generated/grpc"
77+
pb "github.com/example/package/pkg/grpc"
7878
featureserver "github.com/example/package/internal/transport-inbound/grpc/feature-server"
7979
"github.com/rs/zerolog"
8080

@@ -161,7 +161,7 @@ package featureserver
161161
import (
162162
"github.com/example/package/internal/features/commands"
163163
"github.com/example/package/internal/features/queries"
164-
pb "github.com/example/package/internal/generated/grpc"
164+
pb "github.com/example/package/pkg/grpc"
165165
)
166166

167167
// FeatureServer defines the feature server
@@ -199,7 +199,7 @@ import (
199199
"github.com/example/package/internal/transport-inbound/grpc/feature-server/formatters"
200200
"github.com/example/package/internal/transport-inbound/grpc/feature-server/parsers"
201201

202-
pb "github.com/example/package/internal/generated/grpc"
202+
pb "github.com/example/package/pkg/grpc"
203203
)
204204

205205
// ListFeatureEntities ...

docs/project-structure.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ the database / ORM without the use of your repository.
5858
This is where the code for any other feature that does not fit into the above
5959
categories or transport modules should go.
6060

61+
### `pkg/grpc`
62+
63+
This is where `protoc` outputs the generated code for your gRPC services. You
64+
shouldn't add any code here manually.
65+
6166
### Examples
6267

6368
#### `internal/features/controller`

0 commit comments

Comments
 (0)