From 7929921ed838bf737c4c0621e477e75f6743cf90 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 20 Aug 2026 14:45:19 +0100 Subject: [PATCH] build: modernize with "go fix -any": replace interface{} with any --- backend/huaweidrive/api/types.go | 130 ++++++++++++++--------------- backend/huaweidrive/huaweidrive.go | 10 +-- backend/protondrive/protondrive.go | 6 +- 3 files changed, 73 insertions(+), 73 deletions(-) diff --git a/backend/huaweidrive/api/types.go b/backend/huaweidrive/api/types.go index f029e6bc5..3d5f6349c 100644 --- a/backend/huaweidrive/api/types.go +++ b/backend/huaweidrive/api/types.go @@ -37,44 +37,44 @@ type FileList struct { // File represents a file or folder in Huawei Drive type File struct { - ID string `json:"id"` - FileName string `json:"fileName"` - OriginalFilename string `json:"originalFilename,omitempty"` - Description string `json:"description,omitempty"` - MimeType string `json:"mimeType"` - Category string `json:"category"` - Size int64 `json:"size,omitempty"` - SHA256 string `json:"sha256,omitempty"` - CreatedTime time.Time `json:"createdTime"` - EditedTime time.Time `json:"editedTime"` - EditedByMeTime time.Time `json:"editedByMeTime,omitempty"` - ParentFolder []string `json:"parentFolder,omitempty"` - Owners []User `json:"owners"` - LastEditor User `json:"lastEditor"` - Permissions []Permission `json:"permissions"` - PermissionIDs []string `json:"permissionIds"` - Capabilities FileCapabilities `json:"capabilities"` - OwnedByMe bool `json:"ownedByMe"` - EditedByMe bool `json:"editedByMe"` - ViewedByMe bool `json:"viewedByMe"` - HasShared bool `json:"hasShared"` - Recycled bool `json:"recycled"` - DirectlyRecycled bool `json:"directlyRecycled"` - Favorite bool `json:"favorite"` - ExistThumbnail bool `json:"existThumbnail"` - ThumbnailVersion int64 `json:"thumbnailVersion"` - IconDownloadLink string `json:"iconDownloadLink,omitempty"` - ContentDownloadLink string `json:"contentDownloadLink,omitempty"` - ContentVersion string `json:"contentVersion,omitempty"` - LastHistoryVersionID string `json:"lastHistoryVersionId,omitempty"` - OccupiedSpace int64 `json:"occupiedSpace,omitempty"` - Version int64 `json:"version"` - WritersHasSharePermission bool `json:"writersHasSharePermission"` - WriterHasCopyPermission bool `json:"writerHasCopyPermission"` - Containers []string `json:"containers"` - Properties map[string]interface{} `json:"properties,omitempty"` - AppSettings map[string]interface{} `json:"appSettings,omitempty"` - ContentExtras *ContentExtras `json:"contentExtras,omitempty"` + ID string `json:"id"` + FileName string `json:"fileName"` + OriginalFilename string `json:"originalFilename,omitempty"` + Description string `json:"description,omitempty"` + MimeType string `json:"mimeType"` + Category string `json:"category"` + Size int64 `json:"size,omitempty"` + SHA256 string `json:"sha256,omitempty"` + CreatedTime time.Time `json:"createdTime"` + EditedTime time.Time `json:"editedTime"` + EditedByMeTime time.Time `json:"editedByMeTime,omitempty"` + ParentFolder []string `json:"parentFolder,omitempty"` + Owners []User `json:"owners"` + LastEditor User `json:"lastEditor"` + Permissions []Permission `json:"permissions"` + PermissionIDs []string `json:"permissionIds"` + Capabilities FileCapabilities `json:"capabilities"` + OwnedByMe bool `json:"ownedByMe"` + EditedByMe bool `json:"editedByMe"` + ViewedByMe bool `json:"viewedByMe"` + HasShared bool `json:"hasShared"` + Recycled bool `json:"recycled"` + DirectlyRecycled bool `json:"directlyRecycled"` + Favorite bool `json:"favorite"` + ExistThumbnail bool `json:"existThumbnail"` + ThumbnailVersion int64 `json:"thumbnailVersion"` + IconDownloadLink string `json:"iconDownloadLink,omitempty"` + ContentDownloadLink string `json:"contentDownloadLink,omitempty"` + ContentVersion string `json:"contentVersion,omitempty"` + LastHistoryVersionID string `json:"lastHistoryVersionId,omitempty"` + OccupiedSpace int64 `json:"occupiedSpace,omitempty"` + Version int64 `json:"version"` + WritersHasSharePermission bool `json:"writersHasSharePermission"` + WriterHasCopyPermission bool `json:"writerHasCopyPermission"` + Containers []string `json:"containers"` + Properties map[string]any `json:"properties,omitempty"` + AppSettings map[string]any `json:"appSettings,omitempty"` + ContentExtras *ContentExtras `json:"contentExtras,omitempty"` } // IsDir returns true if the file is a directory @@ -125,41 +125,41 @@ type Thumbnail struct { // CreateFolderRequest represents request to create a folder type CreateFolderRequest struct { - FileName string `json:"fileName"` - Description string `json:"description,omitempty"` - MimeType string `json:"mimeType"` - ParentFolder []string `json:"parentFolder,omitempty"` - Favorite bool `json:"favorite,omitempty"` - Properties map[string]interface{} `json:"properties,omitempty"` - AppSettings map[string]interface{} `json:"appSettings,omitempty"` - AutoRename int `json:"autoRename,omitempty"` + FileName string `json:"fileName"` + Description string `json:"description,omitempty"` + MimeType string `json:"mimeType"` + ParentFolder []string `json:"parentFolder,omitempty"` + Favorite bool `json:"favorite,omitempty"` + Properties map[string]any `json:"properties,omitempty"` + AppSettings map[string]any `json:"appSettings,omitempty"` + AutoRename int `json:"autoRename,omitempty"` } // UpdateFileRequest represents request to update a file type UpdateFileRequest struct { - FileName string `json:"fileName,omitempty"` - Description string `json:"description,omitempty"` - MimeType string `json:"mimeType,omitempty"` - Favorite *bool `json:"favorite,omitempty"` - Recycled *bool `json:"recycled,omitempty"` - OriginalFilename string `json:"originalFilename,omitempty"` - WriterHasCopyPermission *bool `json:"writerHasCopyPermission,omitempty"` - WritersHasSharePermission *bool `json:"writersHasSharePermission,omitempty"` - Properties map[string]interface{} `json:"properties,omitempty"` - AppSettings map[string]interface{} `json:"appSettings,omitempty"` - AddParentFolder []string `json:"addParentFolder,omitempty"` - RemoveParentFolder []string `json:"removeParentFolder,omitempty"` - CreatedTime *time.Time `json:"createdTime,omitempty"` - EditedTime *time.Time `json:"editedTime,omitempty"` + FileName string `json:"fileName,omitempty"` + Description string `json:"description,omitempty"` + MimeType string `json:"mimeType,omitempty"` + Favorite *bool `json:"favorite,omitempty"` + Recycled *bool `json:"recycled,omitempty"` + OriginalFilename string `json:"originalFilename,omitempty"` + WriterHasCopyPermission *bool `json:"writerHasCopyPermission,omitempty"` + WritersHasSharePermission *bool `json:"writersHasSharePermission,omitempty"` + Properties map[string]any `json:"properties,omitempty"` + AppSettings map[string]any `json:"appSettings,omitempty"` + AddParentFolder []string `json:"addParentFolder,omitempty"` + RemoveParentFolder []string `json:"removeParentFolder,omitempty"` + CreatedTime *time.Time `json:"createdTime,omitempty"` + EditedTime *time.Time `json:"editedTime,omitempty"` } // CopyFileRequest represents request to copy a file type CopyFileRequest struct { - FileName string `json:"fileName,omitempty"` - MimeType string `json:"mimeType,omitempty"` - ParentFolder []string `json:"parentFolder,omitempty"` - Properties map[string]interface{} `json:"properties,omitempty"` - AppSettings map[string]interface{} `json:"appSettings,omitempty"` + FileName string `json:"fileName,omitempty"` + MimeType string `json:"mimeType,omitempty"` + ParentFolder []string `json:"parentFolder,omitempty"` + Properties map[string]any `json:"properties,omitempty"` + AppSettings map[string]any `json:"appSettings,omitempty"` } // ResumeUploadInitResponse represents response to resume upload init diff --git a/backend/huaweidrive/huaweidrive.go b/backend/huaweidrive/huaweidrive.go index c1721130a..3cda9077c 100644 --- a/backend/huaweidrive/huaweidrive.go +++ b/backend/huaweidrive/huaweidrive.go @@ -1030,7 +1030,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, fs.Debugf(f, "Copy: failed to get metadata options: %v", err) } if len(mergedMeta) > 0 { - copyReq.Properties = make(map[string]interface{}) + copyReq.Properties = make(map[string]any) for key, value := range mergedMeta { switch key { case "content-type", "sha256", "btime", "mtime", "utime", @@ -1720,7 +1720,7 @@ func (o *Object) uploadMultipart(ctx context.Context, in io.Reader, leaf, direct } // Create metadata - metadata := map[string]interface{}{ + metadata := map[string]any{ "fileName": leaf, "mimeType": mimeType, } @@ -1864,7 +1864,7 @@ func (o *Object) uploadResume(ctx context.Context, in io.Reader, leaf, directory } // Prepare metadata for resumable upload initialization - metadata := map[string]interface{}{ + metadata := map[string]any{ "fileName": leaf, } @@ -2082,8 +2082,8 @@ func (o *Object) SetMetadata(ctx context.Context, metadata fs.Metadata) error { // Prepare the update request payload updateReq := api.UpdateFileRequest{ - Properties: make(map[string]interface{}), - AppSettings: make(map[string]interface{}), + Properties: make(map[string]any), + AppSettings: make(map[string]any), } // Process metadata and separate into properties and app settings diff --git a/backend/protondrive/protondrive.go b/backend/protondrive/protondrive.go index 4e3e5933a..142bec421 100644 --- a/backend/protondrive/protondrive.go +++ b/backend/protondrive/protondrive.go @@ -456,9 +456,9 @@ func isDecimalString(value string) bool { // and is captured by --log-file. type protonLogger struct{ f *Fs } -func (l protonLogger) Errorf(format string, v ...interface{}) { fs.Errorf(l.f, format, v...) } -func (l protonLogger) Warnf(format string, v ...interface{}) { fs.Logf(l.f, format, v...) } -func (l protonLogger) Debugf(format string, v ...interface{}) { fs.Debugf(l.f, format, v...) } +func (l protonLogger) Errorf(format string, v ...any) { fs.Errorf(l.f, format, v...) } +func (l protonLogger) Warnf(format string, v ...any) { fs.Logf(l.f, format, v...) } +func (l protonLogger) Debugf(format string, v ...any) { fs.Debugf(l.f, format, v...) } func newProtonDrive(ctx context.Context, f *Fs, opt *Options, m configmap.Mapper) (*protonDriveAPI.ProtonDrive, error) { config := protonDriveAPI.NewDefaultConfig()