build: fix lint errors when re-enabling revive var-naming

This commit is contained in:
Nick Craig-Wood 2023-08-29 12:57:33 +01:00
parent e953598987
commit a83fec756b
3 changed files with 21 additions and 21 deletions

View file

@ -40,7 +40,7 @@ type objectChunkWriter struct {
f *Fs f *Fs
bucket *string bucket *string
key *string key *string
uploadId *string uploadID *string
partsToCommit []objectstorage.CommitMultipartUploadPartDetails partsToCommit []objectstorage.CommitMultipartUploadPartDetails
partsToCommitMu sync.Mutex partsToCommitMu sync.Mutex
existingParts map[int]objectstorage.MultipartUploadPartSummary existingParts map[int]objectstorage.MultipartUploadPartSummary
@ -103,7 +103,7 @@ func (f *Fs) OpenChunkWriter(
chunkSize = chunksize.Calculator(src, size, uploadParts, chunkSize) chunkSize = chunksize.Calculator(src, size, uploadParts, chunkSize)
} }
uploadId, existingParts, err := o.createMultipartUpload(ctx, ui.req) uploadID, existingParts, err := o.createMultipartUpload(ctx, ui.req)
if err != nil { if err != nil {
return -1, nil, fmt.Errorf("create multipart upload request failed: %w", err) return -1, nil, fmt.Errorf("create multipart upload request failed: %w", err)
} }
@ -114,12 +114,12 @@ func (f *Fs) OpenChunkWriter(
f: f, f: f,
bucket: &bucketName, bucket: &bucketName,
key: &bucketPath, key: &bucketPath,
uploadId: &uploadId, uploadID: &uploadID,
existingParts: existingParts, existingParts: existingParts,
ui: ui, ui: ui,
o: o, o: o,
} }
fs.Debugf(o, "open chunk writer: started multipart upload: %v", uploadId) fs.Debugf(o, "open chunk writer: started multipart upload: %v", uploadID)
return int64(chunkSize), chunkWriter, err return int64(chunkSize), chunkWriter, err
} }
@ -161,7 +161,7 @@ func (w *objectChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, rea
NamespaceName: common.String(w.f.opt.Namespace), NamespaceName: common.String(w.f.opt.Namespace),
BucketName: w.bucket, BucketName: w.bucket,
ObjectName: w.key, ObjectName: w.key,
UploadId: w.uploadId, UploadId: w.uploadID,
UploadPartNum: common.Int(ossPartNumber), UploadPartNum: common.Int(ossPartNumber),
ContentLength: common.Int64(currentChunkSize), ContentLength: common.Int64(currentChunkSize),
ContentMD5: common.String(md5sum), ContentMD5: common.String(md5sum),
@ -210,7 +210,7 @@ func (w *objectChunkWriter) Close(ctx context.Context) (err error) {
NamespaceName: common.String(w.f.opt.Namespace), NamespaceName: common.String(w.f.opt.Namespace),
BucketName: w.bucket, BucketName: w.bucket,
ObjectName: w.key, ObjectName: w.key,
UploadId: w.uploadId, UploadId: w.uploadID,
} }
req.PartsToCommit = w.partsToCommit req.PartsToCommit = w.partsToCommit
var resp objectstorage.CommitMultipartUploadResponse var resp objectstorage.CommitMultipartUploadResponse
@ -218,7 +218,7 @@ func (w *objectChunkWriter) Close(ctx context.Context) (err error) {
resp, err = w.f.srv.CommitMultipartUpload(ctx, req) resp, err = w.f.srv.CommitMultipartUpload(ctx, req)
// if multipart is corrupted, we will abort the uploadId // if multipart is corrupted, we will abort the uploadId
if isMultiPartUploadCorrupted(err) { if isMultiPartUploadCorrupted(err) {
fs.Debugf(w.o, "multipart uploadId %v is corrupted, aborting...", *w.uploadId) fs.Debugf(w.o, "multipart uploadId %v is corrupted, aborting...", *w.uploadID)
_ = w.Abort(ctx) _ = w.Abort(ctx)
return false, err return false, err
} }
@ -235,7 +235,7 @@ func (w *objectChunkWriter) Close(ctx context.Context) (err error) {
fs.Errorf(w.o, "multipart upload corrupted: multipart md5 differ: expecting %s but got %s", wantMultipartMd5, gotMultipartMd5) fs.Errorf(w.o, "multipart upload corrupted: multipart md5 differ: expecting %s but got %s", wantMultipartMd5, gotMultipartMd5)
return fmt.Errorf("multipart upload corrupted: md5 differ: expecting %s but got %s", wantMultipartMd5, gotMultipartMd5) return fmt.Errorf("multipart upload corrupted: md5 differ: expecting %s but got %s", wantMultipartMd5, gotMultipartMd5)
} }
fs.Debugf(w.o, "multipart upload %v md5 matched: expecting %s and got %s", *w.uploadId, wantMultipartMd5, gotMultipartMd5) fs.Debugf(w.o, "multipart upload %v md5 matched: expecting %s and got %s", *w.uploadID, wantMultipartMd5, gotMultipartMd5)
return nil return nil
} }
@ -259,11 +259,11 @@ func (w *objectChunkWriter) Abort(ctx context.Context) error {
ctx, ctx,
w.bucket, w.bucket,
w.key, w.key,
w.uploadId) w.uploadID)
if err != nil { if err != nil {
fs.Debugf(w.o, "Failed to cancel multipart upload: %v", err) fs.Debugf(w.o, "Failed to cancel multipart upload: %v", err)
} else { } else {
fs.Debugf(w.o, "canceled and aborted multipart upload: %v", *w.uploadId) fs.Debugf(w.o, "canceled and aborted multipart upload: %v", *w.uploadID)
} }
return err return err
} }

View file

@ -5301,7 +5301,7 @@ type s3ChunkWriter struct {
f *Fs f *Fs
bucket *string bucket *string
key *string key *string
uploadId *string uploadID *string
multiPartUploadInput *s3.CreateMultipartUploadInput multiPartUploadInput *s3.CreateMultipartUploadInput
completedPartsMu sync.Mutex completedPartsMu sync.Mutex
completedParts []*s3.CompletedPart completedParts []*s3.CompletedPart
@ -5370,7 +5370,7 @@ func (f *Fs) OpenChunkWriter(ctx context.Context, remote string, src fs.ObjectIn
f: f, f: f,
bucket: mOut.Bucket, bucket: mOut.Bucket,
key: mOut.Key, key: mOut.Key,
uploadId: mOut.UploadId, uploadID: mOut.UploadId,
multiPartUploadInput: &mReq, multiPartUploadInput: &mReq,
completedParts: make([]*s3.CompletedPart, 0), completedParts: make([]*s3.CompletedPart, 0),
ui: ui, ui: ui,
@ -5438,7 +5438,7 @@ func (w *s3ChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader
Bucket: w.bucket, Bucket: w.bucket,
Key: w.key, Key: w.key,
PartNumber: s3PartNumber, PartNumber: s3PartNumber,
UploadId: w.uploadId, UploadId: w.uploadID,
ContentMD5: &md5sum, ContentMD5: &md5sum,
ContentLength: aws.Int64(currentChunkSize), ContentLength: aws.Int64(currentChunkSize),
RequestPayer: w.multiPartUploadInput.RequestPayer, RequestPayer: w.multiPartUploadInput.RequestPayer,
@ -5479,15 +5479,15 @@ func (w *s3ChunkWriter) Abort(ctx context.Context) error {
_, err := w.f.c.AbortMultipartUploadWithContext(context.Background(), &s3.AbortMultipartUploadInput{ _, err := w.f.c.AbortMultipartUploadWithContext(context.Background(), &s3.AbortMultipartUploadInput{
Bucket: w.bucket, Bucket: w.bucket,
Key: w.key, Key: w.key,
UploadId: w.uploadId, UploadId: w.uploadID,
RequestPayer: w.multiPartUploadInput.RequestPayer, RequestPayer: w.multiPartUploadInput.RequestPayer,
}) })
return w.f.shouldRetry(ctx, err) return w.f.shouldRetry(ctx, err)
}) })
if err != nil { if err != nil {
return fmt.Errorf("failed to abort multipart upload %q: %w", *w.uploadId, err) return fmt.Errorf("failed to abort multipart upload %q: %w", *w.uploadID, err)
} }
fs.Debugf(w.o, "multipart upload %q aborted", *w.uploadId) fs.Debugf(w.o, "multipart upload %q aborted", *w.uploadID)
return err return err
} }
@ -5506,12 +5506,12 @@ func (w *s3ChunkWriter) Close(ctx context.Context) (err error) {
Parts: w.completedParts, Parts: w.completedParts,
}, },
RequestPayer: w.multiPartUploadInput.RequestPayer, RequestPayer: w.multiPartUploadInput.RequestPayer,
UploadId: w.uploadId, UploadId: w.uploadID,
}) })
return w.f.shouldRetry(ctx, err) return w.f.shouldRetry(ctx, err)
}) })
if err != nil { if err != nil {
return fmt.Errorf("failed to complete multipart upload %q: %w", *w.uploadId, err) return fmt.Errorf("failed to complete multipart upload %q: %w", *w.uploadID, err)
} }
if resp != nil { if resp != nil {
if resp.ETag != nil { if resp.ETag != nil {
@ -5521,7 +5521,7 @@ func (w *s3ChunkWriter) Close(ctx context.Context) (err error) {
w.versionID = *resp.VersionId w.versionID = *resp.VersionId
} }
} }
fs.Debugf(w.o, "multipart upload %q finished", *w.uploadId) fs.Debugf(w.o, "multipart upload %q finished", *w.uploadID)
return err return err
} }

View file

@ -47,7 +47,7 @@ func (s *sshClientExternal) Close() error {
// NewSession makes a new external SSH connection // NewSession makes a new external SSH connection
func (s *sshClientExternal) NewSession() (sshSession, error) { func (s *sshClientExternal) NewSession() (sshSession, error) {
session := s.f.newSshSessionExternal() session := s.f.newSSHSessionExternal()
if s.session == nil { if s.session == nil {
fs.Debugf(s.f, "ssh external: creating additional session") fs.Debugf(s.f, "ssh external: creating additional session")
} }
@ -77,7 +77,7 @@ type sshSessionExternal struct {
runningSFTP bool runningSFTP bool
} }
func (f *Fs) newSshSessionExternal() *sshSessionExternal { func (f *Fs) newSSHSessionExternal() *sshSessionExternal {
s := &sshSessionExternal{ s := &sshSessionExternal{
f: f, f: f,
} }