NewClient creates a new GCP GCS client. It automatically respects STORAGE_EMULATOR_HOST if set in the environment.
(ctx context.Context, bucket string)
| 34 | // NewClient creates a new GCP GCS client. |
| 35 | // It automatically respects STORAGE_EMULATOR_HOST if set in the environment. |
| 36 | func NewClient(ctx context.Context, bucket string) (*Client, error) { |
| 37 | storageClient, err := storage.NewClient(ctx) |
| 38 | if err != nil { |
| 39 | return nil, err |
| 40 | } |
| 41 | |
| 42 | return &Client{client: storageClient, bucket: bucket}, nil |
| 43 | } |
| 44 | |
| 45 | func (c *Client) Close() error { |
| 46 | return c.client.Close() |
no outgoing calls