Skip to content

Instantly share code, notes, and snippets.

@jayhuang75
Created October 27, 2021 02:41
Show Gist options
  • Select an option

  • Save jayhuang75/7422282d34bf3400090e870d37849411 to your computer and use it in GitHub Desktop.

Select an option

Save jayhuang75/7422282d34bf3400090e870d37849411 to your computer and use it in GitHub Desktop.
go-train-delay-listener.go
type Lister struct {
pubsub *pubsub.Client
ctx context.Context
}
func NewPubSub(projectID string) (*Lister, error) {
ctx := context.Background()
client, err := pubsub.NewClient(ctx, projectID)
if err != nil {
log.Fatalf("[getPubSub] Unable to get pubsub new client: %v", err)
return nil, err
}
return &Lister{
pubsub: client,
ctx: ctx,
}, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment