pubsub: fix go vet warnings

Change-Id: Ia0844e16f72a8b23624ea8c76d89373ed6e295c7
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/42333
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
diff --git a/pubsub/integration_test.go b/pubsub/integration_test.go
index ca80a78..59bcb3b 100644
--- a/pubsub/integration_test.go
+++ b/pubsub/integration_test.go
@@ -219,7 +219,8 @@
 	// Use a timeout to ensure that Pull does not block indefinitely if there are
 	// unexpectedly few messages available.
 	now := time.Now()
-	timeoutCtx, _ := context.WithTimeout(ctx, time.Minute)
+	timeoutCtx, cancel := context.WithTimeout(ctx, time.Minute)
+	defer cancel()
 	gotMsgs, err := pullN(timeoutCtx, sub, len(want), func(ctx context.Context, m *Message) {
 		m.Ack()
 	})
diff --git a/pubsub/pullstream_test.go b/pubsub/pullstream_test.go
index 8105ce3..a504e3e 100644
--- a/pubsub/pullstream_test.go
+++ b/pubsub/pullstream_test.go
@@ -87,7 +87,7 @@
 	ps := pstest.NewServer()
 	defer ps.Close()
 
-	s := ExhaustedServer{ps.GServer}
+	s := ExhaustedServer{&ps.GServer}
 	pb.RegisterPublisherServer(srv.Gsrv, &s)
 	pb.RegisterSubscriberServer(srv.Gsrv, &s)
 	srv.Start()
@@ -123,7 +123,7 @@
 }
 
 type ExhaustedServer struct {
-	pstest.GServer
+	*pstest.GServer
 }
 
 func (*ExhaustedServer) StreamingPull(_ pb.Subscriber_StreamingPullServer) error {
diff --git a/pubsub/snapshot.go b/pubsub/snapshot.go
index d662f0d..c2a28d7 100644
--- a/pubsub/snapshot.go
+++ b/pubsub/snapshot.go
@@ -106,7 +106,7 @@
 	}
 	_, err = s.c.subc.Seek(ctx, &pb.SeekRequest{
 		Subscription: s.name,
-		Target:       &pb.SeekRequest_Time{ts},
+		Target:       &pb.SeekRequest_Time{Time: ts},
 	})
 	return err
 }
@@ -142,7 +142,7 @@
 func (s *Subscription) SeekToSnapshot(ctx context.Context, snap *Snapshot) error {
 	_, err := s.c.subc.Seek(ctx, &pb.SeekRequest{
 		Subscription: s.name,
-		Target:       &pb.SeekRequest_Snapshot{snap.name},
+		Target:       &pb.SeekRequest_Snapshot{Snapshot: snap.name},
 	})
 	return err
 }
diff --git a/pubsub/streaming_pull_test.go b/pubsub/streaming_pull_test.go
index dac9db9..b1d241b 100644
--- a/pubsub/streaming_pull_test.go
+++ b/pubsub/streaming_pull_test.go
@@ -129,7 +129,8 @@
 	// return only one error.
 	sub.ReceiveSettings.NumGoroutines = 1
 	callbackDone := make(chan struct{})
-	ctx, _ := context.WithTimeout(context.Background(), time.Second)
+	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
+	defer cancel()
 	err := sub.Receive(ctx, func(ctx context.Context, m *Message) {
 		defer close(callbackDone)
 		<-ctx.Done()
@@ -224,7 +225,8 @@
 		server.addStreamingPullMessages([]*pb.ReceivedMessage{newMsg(i), newMsg(i + 1)})
 	}
 	sub := client.Subscription("S")
-	ctx, _ := context.WithTimeout(context.Background(), time.Second)
+	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
+	defer cancel()
 	gotMsgs, err := pullN(ctx, sub, nMessages, func(ctx context.Context, m *Message) {
 		m.Ack()
 	})