From 08266b7256e8b81bf4e846cd392a6b988dca60e8 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 11 Oct 2018 00:08:13 -0700 Subject: [PATCH] go fmt --- weed/command/filer_replication.go | 6 +++--- weed/command/volume.go | 13 +++++++------ weed/filesys/dir.go | 2 +- weed/operation/delete_content.go | 2 +- weed/replication/notification_kafka.go | 8 ++++---- weed/replication/replicator.go | 4 ++-- weed/replication/sink/azuresink/azure_sink.go | 10 +++++----- weed/replication/sink/filersink/filer_sink.go | 4 ++-- weed/replication/sink/gcssink/gcs_sink.go | 6 +++--- weed/replication/sink/s3sink/s3_sink.go | 18 +++++++++--------- weed/replication/sink/s3sink/s3_write.go | 13 +++++++------ 11 files changed, 44 insertions(+), 42 deletions(-) diff --git a/weed/command/filer_replication.go b/weed/command/filer_replication.go index c62b01445..8d5c9d8cc 100644 --- a/weed/command/filer_replication.go +++ b/weed/command/filer_replication.go @@ -5,12 +5,12 @@ import ( "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/replication" - "github.com/chrislusf/seaweedfs/weed/server" - "github.com/spf13/viper" "github.com/chrislusf/seaweedfs/weed/replication/sink" - _ "github.com/chrislusf/seaweedfs/weed/replication/sink/s3sink" _ "github.com/chrislusf/seaweedfs/weed/replication/sink/filersink" _ "github.com/chrislusf/seaweedfs/weed/replication/sink/gcssink" + _ "github.com/chrislusf/seaweedfs/weed/replication/sink/s3sink" + "github.com/chrislusf/seaweedfs/weed/server" + "github.com/spf13/viper" ) func init() { diff --git a/weed/command/volume.go b/weed/command/volume.go index df8d842dc..e8c3f4a3c 100644 --- a/weed/command/volume.go +++ b/weed/command/volume.go @@ -1,17 +1,18 @@ package command import ( + "net/http" "os" "runtime" + "runtime/pprof" "strconv" "strings" - "github.com/chrislusf/seaweedfs/weed/glog" - "github.com/chrislusf/seaweedfs/weed/util" - "net/http" - "github.com/chrislusf/seaweedfs/weed/storage" - "github.com/chrislusf/seaweedfs/weed/server" "time" - "runtime/pprof" + + "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/server" + "github.com/chrislusf/seaweedfs/weed/storage" + "github.com/chrislusf/seaweedfs/weed/util" ) var ( diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go index 95afbf265..d8b0847d3 100644 --- a/weed/filesys/dir.go +++ b/weed/filesys/dir.go @@ -66,7 +66,7 @@ func (dir *Dir) Attr(context context.Context, attr *fuse.Attr) error { return err } - if resp.Entry!=nil { + if resp.Entry != nil { dir.attributes = resp.Entry.Attributes } diff --git a/weed/operation/delete_content.go b/weed/operation/delete_content.go index d2a0c4070..b77718846 100644 --- a/weed/operation/delete_content.go +++ b/weed/operation/delete_content.go @@ -10,9 +10,9 @@ import ( "net/http" + "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/glog" ) type DeleteResult struct { diff --git a/weed/replication/notification_kafka.go b/weed/replication/notification_kafka.go index 87f28f738..3bf917376 100644 --- a/weed/replication/notification_kafka.go +++ b/weed/replication/notification_kafka.go @@ -1,17 +1,17 @@ package replication import ( + "encoding/json" "fmt" + "io/ioutil" + "sync" + "time" "github.com/Shopify/sarama" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" "github.com/golang/protobuf/proto" - "io/ioutil" - "encoding/json" - "sync" - "time" ) func init() { diff --git a/weed/replication/replicator.go b/weed/replication/replicator.go index ba9898915..208e0894a 100644 --- a/weed/replication/replicator.go +++ b/weed/replication/replicator.go @@ -4,11 +4,11 @@ import ( "path/filepath" "strings" + "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/replication/sink" - "github.com/chrislusf/seaweedfs/weed/replication/source" + "github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/glog" ) type Replicator struct { diff --git a/weed/replication/sink/azuresink/azure_sink.go b/weed/replication/sink/azuresink/azure_sink.go index 556dc4a6a..0639ef4ba 100644 --- a/weed/replication/sink/azuresink/azure_sink.go +++ b/weed/replication/sink/azuresink/azure_sink.go @@ -1,17 +1,17 @@ package azuresink import ( + "bytes" "context" "fmt" "net/url" - "bytes" + "github.com/Azure/azure-storage-blob-go/2016-05-31/azblob" + "github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" + "github.com/chrislusf/seaweedfs/weed/replication/sink" "github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/filer2" - "github.com/chrislusf/seaweedfs/weed/replication/sink" - "github.com/Azure/azure-storage-blob-go/2016-05-31/azblob" ) type AzureSink struct { @@ -46,7 +46,7 @@ func (g *AzureSink) SetSourceFiler(s *source.FilerSource) { g.filerSource = s } -func (g *AzureSink) initialize(accountName, accountKey, container, dir string) (error) { +func (g *AzureSink) initialize(accountName, accountKey, container, dir string) error { g.container = container g.dir = dir diff --git a/weed/replication/sink/filersink/filer_sink.go b/weed/replication/sink/filersink/filer_sink.go index d526da1c9..e2974511a 100644 --- a/weed/replication/sink/filersink/filer_sink.go +++ b/weed/replication/sink/filersink/filer_sink.go @@ -7,9 +7,9 @@ import ( "github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" + "github.com/chrislusf/seaweedfs/weed/replication/sink" "github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/replication/sink" ) type FilerSink struct { @@ -22,7 +22,7 @@ type FilerSink struct { dataCenter string } -func init(){ +func init() { sink.Sinks = append(sink.Sinks, &FilerSink{}) } diff --git a/weed/replication/sink/gcssink/gcs_sink.go b/weed/replication/sink/gcssink/gcs_sink.go index 55012ecc7..ae7751c61 100644 --- a/weed/replication/sink/gcssink/gcs_sink.go +++ b/weed/replication/sink/gcssink/gcs_sink.go @@ -7,11 +7,11 @@ import ( "os" "cloud.google.com/go/storage" + "github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" + "github.com/chrislusf/seaweedfs/weed/replication/sink" "github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/filer2" - "github.com/chrislusf/seaweedfs/weed/replication/sink" "google.golang.org/api/option" ) @@ -46,7 +46,7 @@ func (g *GcsSink) SetSourceFiler(s *source.FilerSource) { g.filerSource = s } -func (g *GcsSink) initialize(google_application_credentials, bucketName, dir string) (error) { +func (g *GcsSink) initialize(google_application_credentials, bucketName, dir string) error { g.bucket = bucketName g.dir = dir diff --git a/weed/replication/sink/s3sink/s3_sink.go b/weed/replication/sink/s3sink/s3_sink.go index ad41a0e99..b9caa839b 100644 --- a/weed/replication/sink/s3sink/s3_sink.go +++ b/weed/replication/sink/s3sink/s3_sink.go @@ -4,16 +4,16 @@ import ( "fmt" "sync" - "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" - "github.com/chrislusf/seaweedfs/weed/replication/source" - "github.com/chrislusf/seaweedfs/weed/util" - "github.com/aws/aws-sdk-go/service/s3/s3iface" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/chrislusf/seaweedfs/weed/filer2" - "github.com/chrislusf/seaweedfs/weed/replication/sink" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go/service/s3/s3iface" + "github.com/chrislusf/seaweedfs/weed/filer2" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" + "github.com/chrislusf/seaweedfs/weed/replication/sink" + "github.com/chrislusf/seaweedfs/weed/replication/source" + "github.com/chrislusf/seaweedfs/weed/util" ) type S3Sink struct { @@ -50,7 +50,7 @@ func (s3sink *S3Sink) SetSourceFiler(s *source.FilerSource) { s3sink.filerSource = s } -func (s3sink *S3Sink) initialize(awsAccessKeyId, aswSecretAccessKey, region, bucket, dir string) (error) { +func (s3sink *S3Sink) initialize(awsAccessKeyId, aswSecretAccessKey, region, bucket, dir string) error { s3sink.region = region s3sink.bucket = bucket s3sink.dir = dir diff --git a/weed/replication/sink/s3sink/s3_write.go b/weed/replication/sink/s3sink/s3_write.go index df73e34a7..8ff722e67 100644 --- a/weed/replication/sink/s3sink/s3_write.go +++ b/weed/replication/sink/s3sink/s3_write.go @@ -1,16 +1,17 @@ package S3Sink import ( - "github.com/aws/aws-sdk-go/service/s3" - "github.com/aws/aws-sdk-go/aws" - "github.com/chrislusf/seaweedfs/weed/glog" - "github.com/aws/aws-sdk-go/aws/awserr" + "bytes" "fmt" "io" - "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/s3" "github.com/chrislusf/seaweedfs/weed/filer2" + "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" - "bytes" ) func (s3sink *S3Sink) deleteObject(key string) error {