...
1## Cloud Storage [](https://pkg.go.dev/cloud.google.com/go/storage)
2
3- [About Cloud Storage](https://cloud.google.com/storage/)
4- [API documentation](https://cloud.google.com/storage/docs)
5- [Go client documentation](https://cloud.google.com/go/docs/reference/cloud.google.com/go/storage/latest)
6- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/main/storage)
7
8### Example Usage
9
10First create a `storage.Client` to use throughout your application:
11
12[snip]:# (storage-1)
13```go
14client, err := storage.NewClient(ctx)
15if err != nil {
16 log.Fatal(err)
17}
18```
19
20[snip]:# (storage-2)
21```go
22// Read the object1 from bucket.
23rc, err := client.Bucket("bucket").Object("object1").NewReader(ctx)
24if err != nil {
25 log.Fatal(err)
26}
27defer rc.Close()
28body, err := io.ReadAll(rc)
29if err != nil {
30 log.Fatal(err)
31}
32```
View as plain text