Skip to content

Commit

Permalink
Update to use the latest protobuf package to build pb (coredns#5193)
Browse files Browse the repository at this point in the history
* Update to use the latest protobuf package to build pb

The pb package was generated some time ago with old version
of https://github.com/golang/protobuf which was deprecated
and in favor of google.golang.org/protobuf (see
deprecation notice in https://pkg.go.dev/github.com/golang/protobuf)

This PR updates the generation of pb package with
v1.27.1 of google.golang.org/protobuf.

Signed-off-by: Yong Tang <[email protected]>

* Exclude pb from import test

Signed-off-by: Yong Tang <[email protected]>
  • Loading branch information
yongtang authored Feb 18, 2022
1 parent c0c72e5 commit 2f020dc
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 121 deletions.
1 change: 1 addition & 0 deletions core/dnsserver/server_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
// ServergRPC represents an instance of a DNS-over-gRPC server.
type ServergRPC struct {
*Server
*pb.UnimplementedDnsServiceServer
grpcServer *grpc.Server
listenAddr net.Addr
tlsConfig *tls.Config
Expand Down
9 changes: 8 additions & 1 deletion pb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
# from: https://github.com/golang/protobuf to make this work.
# The generate dns.pb.go is checked into git, so for normal builds we don't need
# to run this generation step.
# Note: The following has been used when regenerate pb:
# curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip
# go install google.golang.org/protobuf/cmd/[email protected]
# go install google.golang.org/grpc/cmd/[email protected]
# export PATH="$PATH:$(go env GOPATH)/bin"
# rm pb/dns.pb.go pb/dns_grpc.pb.go
# make pb

all: dns.pb.go

dns.pb.go: dns.proto
protoc --go_out=plugins=grpc:. dns.proto
protoc --go_out=. --go-grpc_out=. dns.proto

.PHONY: clean
clean:
Expand Down
229 changes: 110 additions & 119 deletions pb/dns.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 pb/dns.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";

package coredns.dns;
option go_package = "pb";
option go_package = ".;pb";

message DnsPacket {
bytes msg = 1;
Expand Down
Loading

0 comments on commit 2f020dc

Please sign in to comment.