From 70648d35ad1a8321e2e1e51a48f781865907f015 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 2 Dec 2019 20:49:58 -0800 Subject: [PATCH] go fmt --- weed/pb/proto_read_write_test.go | 4 ++-- weed/shell/command_volume_tier.go | 2 +- weed/storage/backend/s3_backend/s3_backend.go | 4 ++-- weed/storage/backend/s3_backend/s3_upload.go | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/weed/pb/proto_read_write_test.go b/weed/pb/proto_read_write_test.go index 4c5bca5fe..7f6444ab5 100644 --- a/weed/pb/proto_read_write_test.go +++ b/weed/pb/proto_read_write_test.go @@ -12,8 +12,8 @@ func TestJsonpMarshalUnmarshal(t *testing.T) { tv := &volume_server_pb.RemoteFile{ BackendType: "aws", - BackendId: "", - FileSize: 12, + BackendId: "", + FileSize: 12, } m := jsonpb.Marshaler{ diff --git a/weed/shell/command_volume_tier.go b/weed/shell/command_volume_tier.go index 9047d1199..399f9df51 100644 --- a/weed/shell/command_volume_tier.go +++ b/weed/shell/command_volume_tier.go @@ -135,7 +135,7 @@ func copyDatToRemoteTier(ctx context.Context, grpcDialOption grpc.DialOption, wr } } - processingSpeed := float64(resp.Processed - lastProcessed)/1024.0/1024.0 + processingSpeed := float64(resp.Processed-lastProcessed) / 1024.0 / 1024.0 fmt.Fprintf(writer, "copied %.2f%%, %d bytes, %.2fMB/s\n", resp.ProcessedPercentage, resp.Processed, processingSpeed) diff --git a/weed/storage/backend/s3_backend/s3_backend.go b/weed/storage/backend/s3_backend/s3_backend.go index f2d080b62..0f384aa9c 100644 --- a/weed/storage/backend/s3_backend/s3_backend.go +++ b/weed/storage/backend/s3_backend/s3_backend.go @@ -142,13 +142,13 @@ func (s3backendStorageFile S3BackendStorageFile) GetStat() (datSize int64, modTi files := s3backendStorageFile.tierInfo.GetFiles() - if len(files)==0 { + if len(files) == 0 { err = fmt.Errorf("remote file info not found") return } datSize = int64(files[0].FileSize) - modTime = time.Unix(int64(files[0].ModifiedTime),0) + modTime = time.Unix(int64(files[0].ModifiedTime), 0) return } diff --git a/weed/storage/backend/s3_backend/s3_upload.go b/weed/storage/backend/s3_backend/s3_upload.go index 38acd18ef..97449ea40 100644 --- a/weed/storage/backend/s3_backend/s3_upload.go +++ b/weed/storage/backend/s3_backend/s3_upload.go @@ -12,7 +12,7 @@ import ( ) func uploadToS3(sess s3iface.S3API, filename string, destBucket string, destKey string, - fn func(progressed int64, percentage float32)error) (fileSize int64, err error) { + fn func(progressed int64, percentage float32) error) (fileSize int64, err error) { //open the file f, err := os.Open(filename) @@ -40,10 +40,10 @@ func uploadToS3(sess s3iface.S3API, filename string, destBucket string, destKey }) fileReader := &s3UploadProgressedReader{ - fp: f, - size:fileSize, - read:-fileSize, - fn:fn, + fp: f, + size: fileSize, + read: -fileSize, + fn: fn, } // Upload the file to S3. @@ -71,8 +71,9 @@ type s3UploadProgressedReader struct { fp *os.File size int64 read int64 - fn func(progressed int64, percentage float32)error + fn func(progressed int64, percentage float32) error } + func (r *s3UploadProgressedReader) Read(p []byte) (int, error) { return r.fp.Read(p) } @@ -96,7 +97,6 @@ func (r *s3UploadProgressedReader) ReadAt(p []byte, off int64) (int, error) { return n, err } - func (r *s3UploadProgressedReader) Seek(offset int64, whence int) (int64, error) { return r.fp.Seek(offset, whence) }