-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Client
golang google cloud storage
Environment
Alpine Docker on GKE
go version go1.22.6 linux/amd64
Code and Dependencies
func (c *gcs) CopyObject(ctx context.Context, cmd CopyObjectCommand) (*storage.ObjectAttrs, error) {
bucket := c.client.Bucket(cmd.Bucket)
objAttr, err := bucket.Object(cmd.DestinationPath).CopierFrom(bucket.Object(cmd.SourcePath)).Run(ctx)
if err != nil {
if errors.Is(err, storage.ErrObjectNotExist) {
return nil, application.ErrObjectNotExist
}
}
Client created like this:
storageClient, err := storage.NewClient(ctx, option.WithTelemetryDisabled())
if err != nil {
return fmt.Errorf("failed to create storage client: %w", err)
}
storageClient.SetRetry(
storage.WithBackoff(gax.Backoff{
Initial: cfg.StorageClient.InitialRetryDelay,
Max: cfg.StorageClient.MaxRetryDelay,
Multiplier: cfg.StorageClient.RetryBackoffMultiplier,
}),
storage.WithPolicy(storage.RetryAlways),
)
}
go.mod
module mymodule
go 1.22
require (
cloud.google.com/go/storage v1.43.0
)
Expected behavior
When I call this function with not existed file I expect that the storage.ErrObjectNotExist
returned.
Actual behavior
When I call this function with not existed file, I got the *googleapi.Error
instance.
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.