Skip to content

Commit d0b7c6a

Browse files
authored
Use any keyword consistently (#297)
1 parent 7fec523 commit d0b7c6a

File tree

10 files changed

+15
-13
lines changed

10 files changed

+15
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Style
9+
- Use the `any` keyword where possible.
810

911
## [v7.10.0] - 2025-10-07
1012
### Security

backend/mem/fileSystem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const name = "In-Memory FileSystem"
1717

1818
type fsObject struct {
1919
isFile bool
20-
i interface{}
20+
i any
2121
}
2222
type objMap map[string]*fsObject
2323

backend/s3/fileSystem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (fs *FileSystem) WithOptions(opts vfs.Options) *FileSystem {
148148
// instead of:
149149
//
150150
// fs := s3.NewFileSystem().WithClient(client)
151-
func (fs *FileSystem) WithClient(client interface{}) *FileSystem {
151+
func (fs *FileSystem) WithClient(client any) *FileSystem {
152152
if c, ok := client.(Client); ok {
153153
fs.client = c
154154
fs.options = Options{}

backend/sftp/concurrency_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (s *SFTPConcurrencyTestSuite) TestConcurrentFailedConnections() {
8383
// Start multiple goroutines that will all fail to connect
8484
const numGoroutines = 10
8585
var wg sync.WaitGroup
86-
panicChan := make(chan interface{}, numGoroutines)
86+
panicChan := make(chan any, numGoroutines)
8787
errorChan := make(chan error, numGoroutines)
8888

8989
for range numGoroutines {
@@ -107,7 +107,7 @@ func (s *SFTPConcurrencyTestSuite) TestConcurrentFailedConnections() {
107107
close(errorChan)
108108

109109
// Collect any panics that occurred
110-
panics := make([]interface{}, 0, len(panicChan))
110+
panics := make([]any, 0, len(panicChan))
111111
for panic := range panicChan {
112112
panics = append(panics, panic)
113113
}
@@ -176,7 +176,7 @@ func (s *SFTPConcurrencyTestSuite) TestTimerCleanupRobustness() {
176176
// Start multiple operations that will fail but might trigger the timer
177177
const numOperations = 10
178178
var wg sync.WaitGroup
179-
panicChan := make(chan interface{}, numOperations)
179+
panicChan := make(chan any, numOperations)
180180

181181
for range numOperations {
182182
wg.Add(1)
@@ -204,7 +204,7 @@ func (s *SFTPConcurrencyTestSuite) TestTimerCleanupRobustness() {
204204
close(panicChan)
205205

206206
// Collect any panics that occurred
207-
panics := make([]interface{}, 0, len(panicChan))
207+
panics := make([]any, 0, len(panicChan))
208208
for panic := range panicChan {
209209
panics = append(panics, panic)
210210
}

backend/sftp/fileSystem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func (fs *FileSystem) WithOptions(opts vfs.Options) *FileSystem {
192192
// instead of:
193193
//
194194
// fs := sftp.NewFileSystem().WithClient(client)
195-
func (fs *FileSystem) WithClient(client interface{}) *FileSystem {
195+
func (fs *FileSystem) WithClient(client any) *FileSystem {
196196
switch client.(type) {
197197
case Client, *ssh.Client:
198198
fs.sftpclient = client.(Client)

backend/sftp/options_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ func (o *optionsSuite) TestMarshalOptions() {
517517
pw := "secret1234"
518518
kh := "/path/to/known_hosts"
519519

520-
opts := map[string]interface{}{
520+
opts := map[string]any{
521521
"password": pw,
522522
"keyFilePath": kh,
523523
}

docs/ftp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ftp can be augmented with some implementation-specific methods. [Backend](backen
4040
[vfs.FileSystem](../README.md#type-filesystem) interface, so it would have to be cast as ftp.FileSystem to use
4141
them.
4242

43-
These methods are chainable: (*FileSystem) WithClient(client interface{})
43+
These methods are chainable: (*FileSystem) WithClient(client any)
4444
*FileSystem (*FileSystem) WithOptions(opts vfs.Options) *FileSystem
4545

4646
```go

docs/s3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Scheme return "s3" as the initial part of a file URI ie: s3://
320320
#### func (*FileSystem) WithClient
321321

322322
```go
323-
func (fs *FileSystem) WithClient(client interface{}) *FileSystem
323+
func (fs *FileSystem) WithClient(client any) *FileSystem
324324
```
325325
WithClient passes in an s3 client and returns the filesystem (chainable)
326326

docs/sftp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ them.
4545

4646
These methods are chainable:
4747

48-
* `(*FileSystem) WithClient(client interface{})*FileSystem`
48+
* `(*FileSystem) WithClient(client any)*FileSystem`
4949
* `(*FileSystem) WithOptions(opts vfs.Options) *FileSystem`
5050

5151
```go
@@ -451,7 +451,7 @@ Scheme return "sftp" as the initial part of a file URI ie: sftp://
451451
#### func (*FileSystem) WithClient
452452

453453
```go
454-
func (fs *FileSystem) WithClient(client interface{}) *FileSystem
454+
func (fs *FileSystem) WithClient(client any) *FileSystem
455455
```
456456
WithClient passes in an sftp client and returns the filesystem (chainable)
457457

vfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ type File interface {
248248
// Use the specific options struct for the file system with the NewFileSystem function:
249249
//
250250
// fs := s3.NewFileSystem(s3.WithOptions(s3Opts))
251-
type Options interface{}
251+
type Options any
252252

253253
// Retry is a function that can be used to wrap any operation into a definable retry operation. The wrapped argument
254254
// is called by the underlying VFS implementation.

0 commit comments

Comments
 (0)