maintner/maintpb: use google.protobuf.Timestamp

Add $GOPATH/src to the --proto_path so we can import the google
Timestamp definition instead of redefining a copy in our tree.

Change-Id: I09c3554fb025a32c9db4892b702ee2bedb3c0e53
Reviewed-on: https://go-review.googlesource.com/36899
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/maintner/maintpb/maintner.pb.go b/maintner/maintpb/maintner.pb.go
index d4df160..e014e0f 100644
--- a/maintner/maintpb/maintner.pb.go
+++ b/maintner/maintpb/maintner.pb.go
@@ -13,13 +13,13 @@
 	GithubIssueMutation
 	GithubIssueCommentMutation
 	GithubUser
-	Timestamp
 */
 package maintpb
 
 import proto "github.com/golang/protobuf/proto"
 import fmt "fmt"
 import math "math"
+import google_protobuf "github.com/golang/protobuf/ptypes/timestamp"
 
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = proto.Marshal
@@ -53,8 +53,8 @@
 	Repo    string                        `protobuf:"bytes,2,opt,name=repo" json:"repo,omitempty"`
 	Number  int32                         `protobuf:"varint,3,opt,name=number" json:"number,omitempty"`
 	User    *GithubUser                   `protobuf:"bytes,4,opt,name=user" json:"user,omitempty"`
-	Created *Timestamp                    `protobuf:"bytes,5,opt,name=created" json:"created,omitempty"`
-	Updated *Timestamp                    `protobuf:"bytes,6,opt,name=updated" json:"updated,omitempty"`
+	Created *google_protobuf.Timestamp    `protobuf:"bytes,5,opt,name=created" json:"created,omitempty"`
+	Updated *google_protobuf.Timestamp    `protobuf:"bytes,6,opt,name=updated" json:"updated,omitempty"`
 	Body    string                        `protobuf:"bytes,7,opt,name=body" json:"body,omitempty"`
 	Comment []*GithubIssueCommentMutation `protobuf:"bytes,8,rep,name=comment" json:"comment,omitempty"`
 }
@@ -92,14 +92,14 @@
 	return nil
 }
 
-func (m *GithubIssueMutation) GetCreated() *Timestamp {
+func (m *GithubIssueMutation) GetCreated() *google_protobuf.Timestamp {
 	if m != nil {
 		return m.Created
 	}
 	return nil
 }
 
-func (m *GithubIssueMutation) GetUpdated() *Timestamp {
+func (m *GithubIssueMutation) GetUpdated() *google_protobuf.Timestamp {
 	if m != nil {
 		return m.Updated
 	}
@@ -121,11 +121,11 @@
 }
 
 type GithubIssueCommentMutation struct {
-	Id      int64       `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
-	User    *GithubUser `protobuf:"bytes,2,opt,name=user" json:"user,omitempty"`
-	Body    string      `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"`
-	Created *Timestamp  `protobuf:"bytes,4,opt,name=created" json:"created,omitempty"`
-	Updated *Timestamp  `protobuf:"bytes,5,opt,name=updated" json:"updated,omitempty"`
+	Id      int64                      `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
+	User    *GithubUser                `protobuf:"bytes,2,opt,name=user" json:"user,omitempty"`
+	Body    string                     `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"`
+	Created *google_protobuf.Timestamp `protobuf:"bytes,4,opt,name=created" json:"created,omitempty"`
+	Updated *google_protobuf.Timestamp `protobuf:"bytes,5,opt,name=updated" json:"updated,omitempty"`
 }
 
 func (m *GithubIssueCommentMutation) Reset()                    { *m = GithubIssueCommentMutation{} }
@@ -154,14 +154,14 @@
 	return ""
 }
 
-func (m *GithubIssueCommentMutation) GetCreated() *Timestamp {
+func (m *GithubIssueCommentMutation) GetCreated() *google_protobuf.Timestamp {
 	if m != nil {
 		return m.Created
 	}
 	return nil
 }
 
-func (m *GithubIssueCommentMutation) GetUpdated() *Timestamp {
+func (m *GithubIssueCommentMutation) GetUpdated() *google_protobuf.Timestamp {
 	if m != nil {
 		return m.Updated
 	}
@@ -192,72 +192,38 @@
 	return ""
 }
 
-// Timestamp is a copy of the protobuf well-known Timestamp.
-// TODO: use the official one, after figuring out the protoc command line
-// chicanery.
-type Timestamp struct {
-	// Represents seconds of UTC time since Unix epoch
-	// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
-	// 9999-12-31T23:59:59Z inclusive.
-	Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"`
-	// Non-negative fractions of a second at nanosecond resolution. Negative
-	// second values with fractions must still have non-negative nanos values
-	// that count forward in time. Must be from 0 to 999,999,999
-	// inclusive.
-	Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"`
-}
-
-func (m *Timestamp) Reset()                    { *m = Timestamp{} }
-func (m *Timestamp) String() string            { return proto.CompactTextString(m) }
-func (*Timestamp) ProtoMessage()               {}
-func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
-
-func (m *Timestamp) GetSeconds() int64 {
-	if m != nil {
-		return m.Seconds
-	}
-	return 0
-}
-
-func (m *Timestamp) GetNanos() int32 {
-	if m != nil {
-		return m.Nanos
-	}
-	return 0
-}
-
 func init() {
 	proto.RegisterType((*Mutation)(nil), "maintpb.Mutation")
 	proto.RegisterType((*GithubIssueMutation)(nil), "maintpb.GithubIssueMutation")
 	proto.RegisterType((*GithubIssueCommentMutation)(nil), "maintpb.GithubIssueCommentMutation")
 	proto.RegisterType((*GithubUser)(nil), "maintpb.GithubUser")
-	proto.RegisterType((*Timestamp)(nil), "maintpb.Timestamp")
 }
 
 func init() { proto.RegisterFile("maintner.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
-	// 341 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcd, 0x4a, 0xfb, 0x40,
-	0x14, 0xc5, 0xc9, 0x57, 0xd3, 0xde, 0xfe, 0xe9, 0x62, 0x5a, 0xfe, 0x0c, 0xe2, 0xa2, 0xc4, 0x85,
-	0x5d, 0x48, 0x17, 0x75, 0x29, 0xe2, 0xc2, 0x85, 0x88, 0xb8, 0x19, 0x74, 0x2d, 0x49, 0x73, 0xa9,
-	0x03, 0x66, 0x26, 0xcc, 0x4c, 0x10, 0x9f, 0xca, 0xa7, 0xf0, 0xbd, 0x24, 0x37, 0x1f, 0x2d, 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0x36, 0x48, 0xdf, 0x5a, 0xe7, 0x49, 0xbe, 0x3c, 0x38, 0x39, 0xcc, 0xb1, 0x09, 0xf8,
-	0x32, 0xa7, 0xd6, 0x02, 0xe1, 0xcb, 0xbc, 0xaf, 0xc1, 0x3f, 0x56, 0x43, 0x17, 0x35, 0xd8, 0x89,
-	0xba, 0x53, 0x4d, 0xf8, 0xa7, 0x6a, 0xa2, 0xa3, 0xd5, 0x24, 0x2b, 0x80, 0x6d, 0x86, 0x5f, 0xb1,
-	0x67, 0x10, 0xbd, 0xe9, 0x8d, 0x54, 0xed, 0xa7, 0x6e, 0x44, 0x72, 0x05, 0xa3, 0xfe, 0x12, 0xe3,
-	0x10, 0x5b, 0x5c, 0x6b, 0x95, 0xdb, 0xd6, 0xd7, 0xc9, 0xda, 0xac, 0x52, 0xa5, 0x2d, 0x99, 0x23,
-	0xd1, 0x88, 0x6c, 0x40, 0xff, 0xf1, 0xe5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3b, 0xfd, 0x62,
-	0x8b, 0xd9, 0x02, 0x00, 0x00,
+	// 355 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcf, 0x4a, 0xeb, 0x40,
+	0x14, 0xc6, 0xc9, 0xbf, 0xa6, 0xf7, 0xf4, 0xd2, 0xc5, 0xb4, 0x5c, 0x42, 0xb9, 0x8b, 0x12, 0x17,
+	0x76, 0x35, 0x81, 0xea, 0x4e, 0xc4, 0x85, 0x0b, 0x11, 0x71, 0x13, 0x74, 0x2d, 0x49, 0x33, 0x8e,
+	0x03, 0x9d, 0x3f, 0x4c, 0x66, 0x90, 0x3e, 0x9d, 0x4f, 0xe1, 0xfb, 0x48, 0x26, 0x49, 0x5b, 0xb4,
+	0x52, 0x71, 0x77, 0xce, 0x9c, 0xef, 0x3b, 0xf9, 0xce, 0x8f, 0xc0, 0x98, 0x17, 0x4c, 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0xe2, 0xf6, 0x80, 0xa6, 0x46, 0x97, 0x10, 0xaf, 0x24, 0xe7, 0x44, 0x98, 0x64,
+	0x38, 0x0f, 0x16, 0xa3, 0xe5, 0xc9, 0x21, 0x7c, 0xd7, 0xad, 0x64, 0x4b, 0xb1, 0xf7, 0xa4, 0xef,
+	0x1e, 0xcc, 0xbe, 0xd7, 0xa1, 0x31, 0xf8, 0xac, 0x72, 0x14, 0x83, 0xdc, 0x67, 0xd5, 0x16, 0x8b,
+	0x7f, 0x0c, 0x4b, 0x1f, 0x35, 0xd8, 0x8b, 0xba, 0x87, 0x2a, 0xfc, 0x15, 0xaa, 0xe8, 0xc7, 0xa8,
+	0xd2, 0x25, 0xc0, 0x2e, 0xd3, 0x97, 0x33, 0xa6, 0x10, 0xad, 0x25, 0x65, 0xa2, 0xfb, 0x15, 0xda,
+	0xa6, 0x1c, 0xb8, 0x85, 0x67, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x50, 0x22, 0x93, 0x16, 0xf9,
+	0x02, 0x00, 0x00,
 }
diff --git a/maintner/maintpb/maintner.proto b/maintner/maintpb/maintner.proto
index e280cf0..dbaec87 100644
--- a/maintner/maintpb/maintner.proto
+++ b/maintner/maintpb/maintner.proto
@@ -2,8 +2,11 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// https://developers.google.com/protocol-buffers/docs/proto3
 syntax = "proto3";
 
+import "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto";
+
 package maintpb;
 
 message Mutation {
@@ -16,8 +19,8 @@
   int32 number = 3;  // 1, 2, 3... (not the ID)
 
   GithubUser user = 4;   // only set for new/updated issues, not new comments
-  Timestamp created = 5; // only needed on new issues
-  Timestamp updated = 6; // only set on updated issue text
+  google.protobuf.Timestamp created = 5; // only needed on new issues
+  google.protobuf.Timestamp updated = 6; // only set on updated issue text
   string body = 7; // for new or updated issue text (top post, which isn't a comment)
 
   repeated GithubIssueCommentMutation comment = 8;
@@ -27,27 +30,11 @@
   int64 id = 1;
   GithubUser user = 2;
   string body = 3;
-  Timestamp created = 4;
-  Timestamp updated = 5;
+  google.protobuf.Timestamp created = 4;
+  google.protobuf.Timestamp updated = 5;
 }
 
 message GithubUser {
   int64 id = 1;
   string login = 2;
 }
-
-// Timestamp is a copy of the protobuf well-known Timestamp.
-// TODO: use the official one, after figuring out the protoc command line
-// chicanery.
-message Timestamp {
-  // Represents seconds of UTC time since Unix epoch
-  // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
-  // 9999-12-31T23:59:59Z inclusive.
-  int64 seconds = 1;
-
-  // Non-negative fractions of a second at nanosecond resolution. Negative
-  // second values with fractions must still have non-negative nanos values
-  // that count forward in time. Must be from 0 to 999,999,999
-  // inclusive.
-  int32 nanos = 2;
-}
diff --git a/maintner/maintpb/maintpb.go b/maintner/maintpb/maintpb.go
index 8c538b2..af7f668 100644
--- a/maintner/maintpb/maintpb.go
+++ b/maintner/maintpb/maintpb.go
@@ -4,7 +4,11 @@
 
 package maintpb
 
-// See https://github.com/golang/protobuf#installation and
-// then run "go generate" in this directory to update.
+// Run "go generate" in this directory to update. You need to have:
+// - a protoc binary
+// - a protoc-gen-go binary
+// - go get github.com/golang/protobuf
+//
+// See https://github.com/golang/protobuf#installation for more info.
 
-//go:generate protoc --go_out=plugins=grpc:. maintner.proto
+//go:generate protoc --proto_path=$GOPATH/src:. --go_out=plugins=grpc:. maintner.proto