pubsub: docs example for Subscription.Receive is incorect #9045
Labels
api: pubsub
Issues related to the Pub/Sub API.
type: docs
Improvement to the documentation for an API.
Client
PubSub
Environment
N/A
Go Environment
N/A
Code
According to this example https://github.com/googleapis/google-cloud-go/blob/main/pubsub/example_test.go#L313-L329 we are supposed to assume that something has gone wrong if
err != context.Canceled
but I had a very quick skim through theReceive
source and it seems like it often returnsnil
(notably, including when ctx is done).Expected behavior
I'm not exactly sure if
Receive()
ever returnscontext.Canceled
so I can't say whether the condition should look like:but it should at least look like this if I'm not mistaken:
Please let me know if I've made a mistake, thanks :)
The text was updated successfully, but these errors were encountered: