Created
October 27, 2021 02:41
-
-
Save jayhuang75/7422282d34bf3400090e870d37849411 to your computer and use it in GitHub Desktop.
go-train-delay-listener.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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