-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Client
storage
Environment
go version go1.23.7 linux/amd64
Code and Dependencies
package main
import (
"context"
"gocloud.dev/blob"
_ "gocloud.dev/blob/gcsblob"
)
func main() {
ctx := context.Background()
bucket, err := blob.OpenBucket(ctx, "gs://my-bucket")
if err != nil {
panic(err)
}
exists, err := bucket.Exists(ctx, "valid.tar.gz")
if err != nil {
panic(err)
}
if !exists {
panic("the file should have existed")
}
exists, err = bucket.Exists(ctx, "invalid.tar.gz")
if err != nil {
panic(err)
}
if exists {
panic("the file should not have existed")
}
}
go.mod
module modname
go 1.24.0
require (
...
cloud.google.com/go/storage v1.51.0
gocloud.dev v0.40.0
...
)
Expected behavior
The Exists
method should return false if the object doesn't exist instead of an error.
Actual behavior
The method returns an error instead.
panic: blob (key "invalid.tar.gz") (code=Unknown): storage: object doesn't exist: googleapi: Error 404: No such object: my-bucket/invalid.tar.gz, notFound
Additional context
This is a regression from 1.51.0 and works in 1.50.0.
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the Cloud Storage API.Issues related to the Cloud Storage API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.