Skip to content

Commit 69dfe63

Browse files
committed
Update proto to edition 2024
1 parent 10efa2c commit 69dfe63

9 files changed

Lines changed: 126 additions & 55 deletions

File tree

examples/attributes/client/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ func main() {
7474
a := int64(rand.Intn(10))
7575
b := int64(rand.Intn(10))
7676

77-
resp, err := sumClient.Sum(context.Background(), &proto.SumRequest{
77+
resp, err := sumClient.Sum(context.Background(), proto.SumRequest_builder{
7878
A: &a,
7979
B: &b,
80-
})
80+
}.Build())
8181

8282
if err != nil {
8383
fmt.Println(err)

examples/attributes/server/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func (s *sumServer) Sum(_ context.Context, request *proto.SumRequest) (*proto.Su
3838

3939
fmt.Println("request:", a, "+", b)
4040

41-
return &proto.SumResponse{
41+
return proto.SumResponse_builder{
4242
Sum: &sum,
43-
}, nil
43+
}.Build(), nil
4444
}
4545

4646
func main() {

examples/opentelemetry/client/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ func main() {
7777
a := int64(rand.Intn(10))
7878
b := int64(rand.Intn(10))
7979

80-
resp, err := sumClient.Sum(context.Background(), &proto.SumRequest{
80+
resp, err := sumClient.Sum(context.Background(), proto.SumRequest_builder{
8181
A: &a,
8282
B: &b,
83-
})
83+
}.Build())
8484

8585
if err != nil {
8686
fmt.Println(err)

examples/opentelemetry/server/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ func (s *sumServer) Sum(_ context.Context, request *proto.SumRequest) (*proto.Su
4040

4141
fmt.Println("request:", a, "+", b)
4242

43-
return &proto.SumResponse{
43+
return proto.SumResponse_builder{
4444
Sum: &sum,
45-
}, nil
45+
}.Build(), nil
4646
}
4747

4848
func main() {

examples/quickstart/client/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ func main() {
6161
a := int64(rand.Intn(10))
6262
b := int64(rand.Intn(10))
6363

64-
resp, err := sumClient.Sum(context.Background(), &proto.SumRequest{
64+
resp, err := sumClient.Sum(context.Background(), proto.SumRequest_builder{
6565
A: &a,
6666
B: &b,
67-
})
67+
}.Build())
6868

6969
if err != nil {
7070
fmt.Println(err)

examples/quickstart/proto/sum.pb.go

Lines changed: 110 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/quickstart/proto/sum.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
edition = "2023";
17+
edition = "2024";
1818

1919
option go_package = "github.com/nexcode/rpcplatform/examples/quickstart/proto";
2020

examples/quickstart/proto/sum_grpc.pb.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/quickstart/server/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func (s *sumServer) Sum(_ context.Context, request *proto.SumRequest) (*proto.Su
3838

3939
fmt.Println("request:", a, "+", b)
4040

41-
return &proto.SumResponse{
41+
return proto.SumResponse_builder{
4242
Sum: &sum,
43-
}, nil
43+
}.Build(), nil
4444
}
4545

4646
func main() {

0 commit comments

Comments
 (0)