3

in proto file...

syntax = "proto3";

import "google/protobuf/duration.proto";

message aaaResponse{
  google.protobuf.Duration  min   = 2;
 }

... will auto generate *duration.Duration

how to change the proto file to get time.Duration

CallMeLoki
  • 1,281
  • 10
  • 23
halle
  • 31
  • 1
  • 2
  • 1
    try https://github.com/gogo/protobuf instead of google's protobuf library. There is an [extension](https://github.com/gogo/protobuf/blob/master/extensions.md) that converts duration.Duration to time.Duration. – fl0cke Nov 04 '18 at 16:23
  • What is unclear about the documentation? https://developers.google.com/protocol-buffers/docs/reference/csharp/class/google/protobuf/well-known-types/duration – martwetzels Nov 15 '18 at 10:01

1 Answers1

0

Try this :

go get github.com/gogo/protobuf/protoc-gen-gogofaster

protoc --gogofaster_out=./ duration.proto
Mostafa Solati
  • 1,235
  • 2
  • 13
  • 33