Skip to content

Commit 1ba15b5

Browse files
Merge pull request #439 from spf13/update-dependencies
Update dependencies
2 parents 77b5f5d + dac11c4 commit 1ba15b5

File tree

16 files changed

+772
-169
lines changed

16 files changed

+772
-169
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, macos-latest, windows-latest]
17-
go: ["1.19", "1.20", "1.21", "1.22", "1.23"]
17+
go: ["1.21", "1.22", "1.23"]
1818

1919
steps:
2020
- name: Checkout repository

.golangci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ linters:
1111
- gofmt
1212
# - gofumpt
1313
- staticcheck
14+
15+
issues:
16+
exclude-dirs:
17+
- gcsfs/internal/stiface

gcsfs/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"sort"
2727
"syscall"
2828

29-
"github.com/googleapis/google-cloud-go-testing/storage/stiface"
29+
"github.com/spf13/afero/gcsfs/internal/stiface"
3030

3131
"cloud.google.com/go/storage"
3232

gcsfs/file_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"os"
2525
"syscall"
2626

27-
"github.com/googleapis/google-cloud-go-testing/storage/stiface"
27+
"github.com/spf13/afero/gcsfs/internal/stiface"
2828
)
2929

3030
const (

gcsfs/fs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"syscall"
2626
"time"
2727

28-
"github.com/googleapis/google-cloud-go-testing/storage/stiface"
28+
"github.com/spf13/afero/gcsfs/internal/stiface"
2929
)
3030

3131
const (

gcsfs/gcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"time"
2323

2424
"cloud.google.com/go/storage"
25-
"github.com/googleapis/google-cloud-go-testing/storage/stiface"
2625
"github.com/spf13/afero"
26+
"github.com/spf13/afero/gcsfs/internal/stiface"
2727

2828
"google.golang.org/api/option"
2929
)

gcsfs/gcs_mocks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
"strings"
1919

2020
"cloud.google.com/go/storage"
21-
"github.com/googleapis/google-cloud-go-testing/storage/stiface"
2221
"github.com/spf13/afero"
22+
"github.com/spf13/afero/gcsfs/internal/stiface"
2323
"google.golang.org/api/iterator"
2424
)
2525

gcsfs/gcs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020
"golang.org/x/oauth2/google"
2121

2222
"cloud.google.com/go/storage"
23-
"github.com/googleapis/google-cloud-go-testing/storage/stiface"
2423
"github.com/spf13/afero"
24+
"github.com/spf13/afero/gcsfs/internal/stiface"
2525
)
2626

2727
const (

gcsfs/internal/stiface/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copy of [google-cloud-go-testing](https://github.com/googleapis/google-cloud-go-testing)
2+
3+
This is a temporary copy of the [google-cloud-go-testing](https://github.com/googleapis/google-cloud-go-testing) library.
4+
The library is deprecated and the code was copied here to drop it as a dependency (allowing to upgrade other library dependencies).

gcsfs/internal/stiface/adapters.go

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package stiface
16+
17+
import (
18+
"context"
19+
20+
"cloud.google.com/go/storage"
21+
)
22+
23+
// AdaptClient adapts a storage.Client so that it satisfies the Client
24+
// interface.
25+
func AdaptClient(c *storage.Client) Client {
26+
return client{c}
27+
}
28+
29+
type (
30+
client struct{ *storage.Client }
31+
bucketHandle struct{ *storage.BucketHandle }
32+
objectHandle struct{ *storage.ObjectHandle }
33+
bucketIterator struct{ *storage.BucketIterator }
34+
objectIterator struct{ *storage.ObjectIterator }
35+
reader struct{ *storage.Reader }
36+
writer struct{ *storage.Writer }
37+
copier struct{ *storage.Copier }
38+
composer struct{ *storage.Composer }
39+
aclHandle struct{ *storage.ACLHandle }
40+
)
41+
42+
func (client) embedToIncludeNewMethods() {}
43+
func (bucketHandle) embedToIncludeNewMethods() {}
44+
func (objectHandle) embedToIncludeNewMethods() {}
45+
func (bucketIterator) embedToIncludeNewMethods() {}
46+
func (objectIterator) embedToIncludeNewMethods() {}
47+
func (writer) embedToIncludeNewMethods() {}
48+
func (reader) embedToIncludeNewMethods() {}
49+
func (copier) embedToIncludeNewMethods() {}
50+
func (composer) embedToIncludeNewMethods() {}
51+
func (aclHandle) embedToIncludeNewMethods() {}
52+
53+
func (c client) Bucket(name string) BucketHandle {
54+
return bucketHandle{c.Client.Bucket(name)}
55+
}
56+
57+
func (c client) Buckets(ctx context.Context, projectID string) BucketIterator {
58+
return bucketIterator{c.Client.Buckets(ctx, projectID)}
59+
}
60+
61+
func (b bucketHandle) Object(name string) ObjectHandle {
62+
return objectHandle{b.BucketHandle.Object(name)}
63+
}
64+
65+
func (b bucketHandle) If(conds storage.BucketConditions) BucketHandle {
66+
return bucketHandle{b.BucketHandle.If(conds)}
67+
}
68+
69+
func (b bucketHandle) Objects(ctx context.Context, q *storage.Query) ObjectIterator {
70+
return objectIterator{b.BucketHandle.Objects(ctx, q)}
71+
}
72+
73+
func (b bucketHandle) DefaultObjectACL() ACLHandle {
74+
return aclHandle{b.BucketHandle.DefaultObjectACL()}
75+
}
76+
77+
func (b bucketHandle) ACL() ACLHandle {
78+
return aclHandle{b.BucketHandle.ACL()}
79+
}
80+
81+
func (b bucketHandle) UserProject(projectID string) BucketHandle {
82+
return bucketHandle{b.BucketHandle.UserProject(projectID)}
83+
}
84+
85+
func (bi bucketIterator) SetPrefix(s string) {
86+
bi.BucketIterator.Prefix = s
87+
}
88+
89+
func (o objectHandle) ACL() ACLHandle {
90+
return aclHandle{o.ObjectHandle.ACL()}
91+
}
92+
93+
func (o objectHandle) Generation(gen int64) ObjectHandle {
94+
return objectHandle{o.ObjectHandle.Generation(gen)}
95+
}
96+
97+
func (o objectHandle) If(conds storage.Conditions) ObjectHandle {
98+
return objectHandle{o.ObjectHandle.If(conds)}
99+
}
100+
101+
func (o objectHandle) Key(encryptionKey []byte) ObjectHandle {
102+
return objectHandle{o.ObjectHandle.Key(encryptionKey)}
103+
}
104+
105+
func (o objectHandle) ReadCompressed(compressed bool) ObjectHandle {
106+
return objectHandle{o.ObjectHandle.ReadCompressed(compressed)}
107+
}
108+
109+
func (o objectHandle) NewReader(ctx context.Context) (Reader, error) {
110+
r, err := o.ObjectHandle.NewReader(ctx)
111+
if err != nil {
112+
return nil, err
113+
}
114+
return reader{r}, nil
115+
}
116+
117+
func (o objectHandle) NewRangeReader(ctx context.Context, offset, length int64) (Reader, error) {
118+
r, err := o.ObjectHandle.NewRangeReader(ctx, offset, length)
119+
if err != nil {
120+
return nil, err
121+
}
122+
return reader{r}, nil
123+
}
124+
125+
func (o objectHandle) NewWriter(ctx context.Context) Writer {
126+
return writer{o.ObjectHandle.NewWriter(ctx)}
127+
}
128+
129+
func (o objectHandle) CopierFrom(src ObjectHandle) Copier {
130+
return copier{o.ObjectHandle.CopierFrom(src.(objectHandle).ObjectHandle)}
131+
}
132+
133+
func (o objectHandle) ComposerFrom(srcs ...ObjectHandle) Composer {
134+
objs := make([]*storage.ObjectHandle, len(srcs))
135+
for i, s := range srcs {
136+
objs[i] = s.(objectHandle).ObjectHandle
137+
}
138+
return composer{o.ObjectHandle.ComposerFrom(objs...)}
139+
}
140+
141+
func (w writer) ObjectAttrs() *storage.ObjectAttrs {
142+
return &w.Writer.ObjectAttrs
143+
}
144+
145+
func (w writer) SetChunkSize(s int) {
146+
w.ChunkSize = s
147+
}
148+
149+
func (w writer) SetProgressFunc(f func(int64)) {
150+
w.ProgressFunc = f
151+
}
152+
153+
func (w writer) SetCRC32C(c uint32) {
154+
w.CRC32C = c
155+
w.SendCRC32C = true
156+
}
157+
158+
func (c copier) ObjectAttrs() *storage.ObjectAttrs {
159+
return &c.Copier.ObjectAttrs
160+
}
161+
162+
func (c copier) SetRewriteToken(t string) {
163+
c.RewriteToken = t
164+
}
165+
166+
func (c copier) SetProgressFunc(f func(copiedBytes, totalBytes uint64)) {
167+
c.ProgressFunc = f
168+
}
169+
170+
func (c copier) SetDestinationKMSKeyName(k string) {
171+
c.DestinationKMSKeyName = k
172+
}
173+
174+
func (c composer) ObjectAttrs() *storage.ObjectAttrs {
175+
return &c.Composer.ObjectAttrs
176+
}

0 commit comments

Comments
 (0)