Skip to content

Commit 7634ccd

Browse files
committed
Upgrade to latest protoc
Signed-off-by: Dimitri John Ledkov <[email protected]>
1 parent 2b70d82 commit 7634ccd

File tree

7 files changed

+1489
-1444
lines changed

7 files changed

+1489
-1444
lines changed

.github/workflows/repo-quality.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- name: Install go grpc protoc generator
7070
run: |
7171
cd ..
72-
GO111MODULE=on go get github.com/golang/protobuf/protoc-gen-go && \
72+
GO111MODULE=on go get google.golang.org/protobuf/cmd/protoc-gen-go && \
7373
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
7474
cd -
7575
- name: Check generated files

internal/streamlogger/generator.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,18 @@ func main() {
8989

9090
src := args[1]
9191
dest := fmt.Sprintf("%s.streamlogger.go", strings.TrimSuffix(src, ".pb.go"))
92+
srcgrpc := fmt.Sprintf("%s_grpc.pb.go", strings.TrimSuffix(src, ".pb.go"))
9293

9394
fset := token.NewFileSet()
9495
f, err := parser.ParseFile(fset, src, nil, parser.ParseComments)
9596
if err != nil {
9697
log.Fatalf("coudln't parse file: %v", err)
9798
}
99+
fgrpc, err := parser.ParseFile(fset, srcgrpc, nil, parser.ParseComments)
100+
if err != nil {
101+
log.Fatalf("coudln't parse file: %v", err)
102+
}
103+
f.Decls = append(f.Decls, fgrpc.Decls...)
98104

99105
// Package name
100106
data := pbData{
@@ -191,6 +197,10 @@ func main() {
191197
function := callFunc.Names[0].Name
192198

193199
fields := callFunc.Type.(*ast.FuncType).Params.List
200+
201+
if (len(fields) != 2) {
202+
continue
203+
}
194204
reqType := fields[0].Type.(*ast.StarExpr).X.(*ast.Ident).Name
195205
origStream := fields[1].Type.(*ast.Ident).Name
196206

zsys.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"google.golang.org/grpc"
1414
)
1515

16-
//go:generate sh -c "if go run internal/generators/can_modify_repo.go 2>/dev/null; then PATH=\"$PATH:`go env GOPATH`/bin\" protoc --go_out=plugins=grpc:. zsys.proto; fi"
16+
//go:generate sh -c "if go run internal/generators/can_modify_repo.go 2>/dev/null; then PATH=\"$PATH:`go env GOPATH`/bin\" protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative zsys.proto; fi"
1717
// Takes output of protoc for second streamlogger generation.
1818
//go:generate go run internal/streamlogger/generator.go -- zsys.pb.go
1919

0 commit comments

Comments
 (0)