aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-09-12 04:08:03 -0700
committerChris Lu <chris.lu@gmail.com>2020-09-12 04:08:03 -0700
commit446e476a11cb2b6bb947ae39619099c09fdd091c (patch)
tree5a06a8bf0a7092e8238b2543cdf4a945a020dad3
parentea26a98753b7f15b561504166469760237e49c3b (diff)
downloadseaweedfs-446e476a11cb2b6bb947ae39619099c09fdd091c.tar.xz
seaweedfs-446e476a11cb2b6bb947ae39619099c09fdd091c.zip
go fmt
-rw-r--r--weed/command/filer_sync.go2
-rw-r--r--weed/filer/meta_aggregator.go8
-rw-r--r--weed/replication/replicator.go1
-rw-r--r--weed/shell/command_volume_balance.go2
-rw-r--r--weed/shell/command_volume_balance_test.go2
-rw-r--r--weed/storage/needle_map_memory.go2
-rw-r--r--weed/storage/needle_map_metric_test.go2
-rw-r--r--weed/util/compression.go8
8 files changed, 12 insertions, 15 deletions
diff --git a/weed/command/filer_sync.go b/weed/command/filer_sync.go
index a1d0bd2ac..cafd51a16 100644
--- a/weed/command/filer_sync.go
+++ b/weed/command/filer_sync.go
@@ -36,7 +36,7 @@ type SyncOptions struct {
}
var (
- syncOptions SyncOptions
+ syncOptions SyncOptions
syncCpuProfile *string
syncMemProfile *string
)
diff --git a/weed/filer/meta_aggregator.go b/weed/filer/meta_aggregator.go
index c1e73aaf9..e95b457a4 100644
--- a/weed/filer/meta_aggregator.go
+++ b/weed/filer/meta_aggregator.go
@@ -87,7 +87,7 @@ func (ma *MetaAggregator) subscribeToOneFiler(f *Filer, self string, peer string
if err := ma.updateOffset(f, peer, peerSignature, event.TsNs); err == nil {
if event.TsNs < time.Now().Add(-2*time.Minute).UnixNano() {
glog.V(0).Infof("sync with %s progressed to: %v %0.2f/sec", peer, time.Unix(0, event.TsNs), float64(counter)/60.0)
- } else if !synced{
+ } else if !synced {
synced = true
glog.V(0).Infof("synced with %s", peer)
}
@@ -162,13 +162,13 @@ func (ma *MetaAggregator) readFilerStoreSignature(peer string) (sig int32, err e
return
}
-const(
+const (
MetaOffsetPrefix = "Meta"
)
func (ma *MetaAggregator) readOffset(f *Filer, peer string, peerSignature int32) (lastTsNs int64, err error) {
- key := []byte(MetaOffsetPrefix+"xxxx")
+ key := []byte(MetaOffsetPrefix + "xxxx")
util.Uint32toBytes(key[len(MetaOffsetPrefix):], uint32(peerSignature))
value, err := f.Store.KvGet(context.Background(), key)
@@ -191,7 +191,7 @@ func (ma *MetaAggregator) readOffset(f *Filer, peer string, peerSignature int32)
func (ma *MetaAggregator) updateOffset(f *Filer, peer string, peerSignature int32, lastTsNs int64) (err error) {
- key := []byte(MetaOffsetPrefix+"xxxx")
+ key := []byte(MetaOffsetPrefix + "xxxx")
util.Uint32toBytes(key[len(MetaOffsetPrefix):], uint32(peerSignature))
value := make([]byte, 8)
diff --git a/weed/replication/replicator.go b/weed/replication/replicator.go
index e0535175e..c4228434f 100644
--- a/weed/replication/replicator.go
+++ b/weed/replication/replicator.go
@@ -84,4 +84,3 @@ func ReadFilerSignature(grpcDialOption grpc.DialOption, filer string) (filerSign
}
return filerSignature, nil
}
-
diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.go
index c92d61e35..624821431 100644
--- a/weed/shell/command_volume_balance.go
+++ b/weed/shell/command_volume_balance.go
@@ -174,7 +174,7 @@ func (n *Node) localVolumeRatio() float64 {
}
func (n *Node) localVolumeNextRatio() float64 {
- return divide(len(n.selectedVolumes) + 1, int(n.info.MaxVolumeCount))
+ return divide(len(n.selectedVolumes)+1, int(n.info.MaxVolumeCount))
}
func (n *Node) selectVolumes(fn func(v *master_pb.VolumeInformationMessage) bool) {
diff --git a/weed/shell/command_volume_balance_test.go b/weed/shell/command_volume_balance_test.go
index 4f46648c0..9e154dc00 100644
--- a/weed/shell/command_volume_balance_test.go
+++ b/weed/shell/command_volume_balance_test.go
@@ -20,7 +20,6 @@ func TestIsGoodMove(t *testing.T) {
var tests = []testMoveCase{
-
{
name: "test 100 move to spread into proper data centers",
replication: "100",
@@ -132,7 +131,6 @@ func TestIsGoodMove(t *testing.T) {
targetLocation: location{"dc1", "r2", &master_pb.DataNodeInfo{Id: "dn3"}},
expected: true,
},
-
}
for _, tt := range tests {
diff --git a/weed/storage/needle_map_memory.go b/weed/storage/needle_map_memory.go
index 3fa85deda..23ee561d0 100644
--- a/weed/storage/needle_map_memory.go
+++ b/weed/storage/needle_map_memory.go
@@ -65,7 +65,7 @@ func (nm *NeedleMap) Get(key NeedleId) (existingValue *needle_map.NeedleValue, o
}
func (nm *NeedleMap) Delete(key NeedleId) error {
existingValue, ok := nm.m.Get(NeedleId(key))
- if !ok || existingValue.Size.IsDeleted(){
+ if !ok || existingValue.Size.IsDeleted() {
return nil
}
deletedBytes := nm.m.Delete(NeedleId(key))
diff --git a/weed/storage/needle_map_metric_test.go b/weed/storage/needle_map_metric_test.go
index 0c792869f..a460b3408 100644
--- a/weed/storage/needle_map_metric_test.go
+++ b/weed/storage/needle_map_metric_test.go
@@ -17,7 +17,7 @@ func TestFastLoadingNeedleMapMetrics(t *testing.T) {
for i := 0; i < 10000; i++ {
nm.Put(Uint64ToNeedleId(uint64(i+1)), Uint32ToOffset(uint32(0)), Size(1))
if rand.Float32() < 0.2 {
- nm.Delete(Uint64ToNeedleId(uint64(rand.Int63n(int64(i))+1)))
+ nm.Delete(Uint64ToNeedleId(uint64(rand.Int63n(int64(i)) + 1)))
}
}
diff --git a/weed/util/compression.go b/weed/util/compression.go
index 736f76a5e..cf3ac7c57 100644
--- a/weed/util/compression.go
+++ b/weed/util/compression.go
@@ -12,11 +12,11 @@ import (
"github.com/klauspost/compress/zstd"
)
-var(
+var (
UnsupportedCompression = fmt.Errorf("unsupported compression")
)
-func MaybeGzipData(input []byte) ([]byte) {
+func MaybeGzipData(input []byte) []byte {
if IsGzippedContent(input) {
return input
}
@@ -24,13 +24,13 @@ func MaybeGzipData(input []byte) ([]byte) {
if err != nil {
return input
}
- if len(gzipped) * 10 > len(input) * 9 {
+ if len(gzipped)*10 > len(input)*9 {
return input
}
return gzipped
}
-func MaybeDecompressData(input []byte) ([]byte) {
+func MaybeDecompressData(input []byte) []byte {
uncompressed, err := DecompressData(input)
if err != nil {
if err != UnsupportedCompression {