@@ -24,15 +24,15 @@ import (
2424 "os"
2525 "path/filepath"
2626
27- gcpStorage "cloud.google.com/go/storage"
28- interator "google.golang.org/api/iterator"
27+ gcpstorage "cloud.google.com/go/storage"
28+ "google.golang.org/api/iterator"
2929 "google.golang.org/api/option"
3030)
3131
3232var (
3333 // IteratorDone is returned when the looping of objects/content
3434 // has reached the end of the iteration.
35- IteratorDone = interator .Done
35+ IteratorDone = iterator .Done
3636 // ErrorDirectoryExists is an error returned when the filename provided
3737 // is a directory.
3838 ErrorDirectoryExists = errors .New ("filename is a directory" )
@@ -44,15 +44,13 @@ var (
4444type GCPClient struct {
4545 // client for interacting with the Google Cloud
4646 // Storage APIs.
47- * gcpStorage .Client
47+ * gcpstorage .Client
4848}
4949
50- // NewClient creates a new GCP storage client
51- // The Google Storage Client will automatically
52- // look for the Google Application Credential environment variable
53- // or look for the Google Application Credential file.
50+ // NewClient creates a new GCP storage client. The Client will automatically look for the Google Application
51+ // Credential environment variable or look for the Google Application Credential file.
5452func NewClient (ctx context.Context , opts ... option.ClientOption ) (* GCPClient , error ) {
55- client , err := gcpStorage .NewClient (ctx , opts ... )
53+ client , err := gcpstorage .NewClient (ctx , opts ... )
5654 if err != nil {
5755 return nil , err
5856 }
@@ -73,7 +71,7 @@ func ValidateSecret(secret map[string][]byte, name string) error {
7371// BucketExists checks if the bucket with the provided name exists.
7472func (c * GCPClient ) BucketExists (ctx context.Context , bucketName string ) (bool , error ) {
7573 _ , err := c .Client .Bucket (bucketName ).Attrs (ctx )
76- if err == gcpStorage .ErrBucketNotExist {
74+ if err == gcpstorage .ErrBucketNotExist {
7775 return false , err
7876 }
7977 if err != nil {
@@ -86,7 +84,7 @@ func (c *GCPClient) BucketExists(ctx context.Context, bucketName string) (bool,
8684func (c * GCPClient ) ObjectExists (ctx context.Context , bucketName , objectName string ) (bool , error ) {
8785 _ , err := c .Client .Bucket (bucketName ).Object (objectName ).Attrs (ctx )
8886 // ErrObjectNotExist is returned if the object does not exist
89- if err == gcpStorage .ErrObjectNotExist {
87+ if err == gcpstorage .ErrObjectNotExist {
9088 return false , err
9189 }
9290 if err != nil {
@@ -160,7 +158,7 @@ func (c *GCPClient) FGetObject(ctx context.Context, bucketName, objectName, loca
160158// ListObjects lists the objects/contents of the bucket whose bucket name is provided.
161159// the objects are returned as an Objectiterator and .Next() has to be called on them
162160// to loop through the Objects.
163- func (c * GCPClient ) ListObjects (ctx context.Context , bucketName string , query * gcpStorage .Query ) * gcpStorage .ObjectIterator {
161+ func (c * GCPClient ) ListObjects (ctx context.Context , bucketName string , query * gcpstorage .Query ) * gcpstorage .ObjectIterator {
164162 items := c .Client .Bucket (bucketName ).Objects (ctx , query )
165163 return items
166164}
0 commit comments