aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage
diff options
context:
space:
mode:
authorZach <zach.ramsay@gmail.com>2017-12-13 02:05:47 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-12-13 02:05:47 +0800
commit3da1bf8ca18f54d9bd2c8c110854dc071ee3898b (patch)
tree8346c96f35f065f098944e425baca74880965232 /swarm/storage
parentbbea4b2b53be53fc07b620c426bda80732a8814b (diff)
downloaddexon-3da1bf8ca18f54d9bd2c8c110854dc071ee3898b.tar
dexon-3da1bf8ca18f54d9bd2c8c110854dc071ee3898b.tar.gz
dexon-3da1bf8ca18f54d9bd2c8c110854dc071ee3898b.tar.bz2
dexon-3da1bf8ca18f54d9bd2c8c110854dc071ee3898b.tar.lz
dexon-3da1bf8ca18f54d9bd2c8c110854dc071ee3898b.tar.xz
dexon-3da1bf8ca18f54d9bd2c8c110854dc071ee3898b.tar.zst
dexon-3da1bf8ca18f54d9bd2c8c110854dc071ee3898b.zip
all: use gometalinter.v2, fix new gosimple issues (#15650)
Diffstat (limited to 'swarm/storage')
-rw-r--r--swarm/storage/chunker_test.go4
-rw-r--r--swarm/storage/pyramid.go16
2 files changed, 10 insertions, 10 deletions
diff --git a/swarm/storage/chunker_test.go b/swarm/storage/chunker_test.go
index b41d7dd33..6178a7bb1 100644
--- a/swarm/storage/chunker_test.go
+++ b/swarm/storage/chunker_test.go
@@ -77,7 +77,7 @@ func (self *chunkerTester) Split(chunker Splitter, data io.Reader, size int64, c
key, err = chunker.Split(data, size, chunkC, swg, nil)
if err != nil && expectedError == nil {
- err = errors.New(fmt.Sprintf("Split error: %v", err))
+ err = fmt.Errorf("Split error: %v", err)
}
if chunkC != nil {
@@ -123,7 +123,7 @@ func (self *chunkerTester) Append(chunker Splitter, rootKey Key, data io.Reader,
key, err = chunker.Append(rootKey, data, chunkC, swg, nil)
if err != nil && expectedError == nil {
- err = errors.New(fmt.Sprintf("Append error: %v", err))
+ err = fmt.Errorf("Append error: %v", err)
}
if chunkC != nil {
diff --git a/swarm/storage/pyramid.go b/swarm/storage/pyramid.go
index 5de385dcb..f2e85cb5b 100644
--- a/swarm/storage/pyramid.go
+++ b/swarm/storage/pyramid.go
@@ -391,7 +391,7 @@ func (self *PyramidChunker) prepareChunks(isAppend bool, chunkLevel [][]*TreeEnt
parent := NewTreeEntry(self)
var unFinishedChunk *Chunk
- if isAppend == true && len(chunkLevel[0]) != 0 {
+ if isAppend && len(chunkLevel[0]) != 0 {
lastIndex := len(chunkLevel[0]) - 1
ent := chunkLevel[0][lastIndex]
@@ -512,7 +512,7 @@ func (self *PyramidChunker) buildTree(isAppend bool, chunkLevel [][]*TreeEntry,
}
}
- if compress == false && last == false {
+ if !compress && !last {
return
}
@@ -522,7 +522,7 @@ func (self *PyramidChunker) buildTree(isAppend bool, chunkLevel [][]*TreeEntry,
for lvl := int64(ent.level); lvl < endLvl; lvl++ {
lvlCount := int64(len(chunkLevel[lvl]))
- if lvlCount == 1 && last == true {
+ if lvlCount == 1 && last {
copy(rootKey, chunkLevel[lvl][0].key)
return
}
@@ -540,7 +540,7 @@ func (self *PyramidChunker) buildTree(isAppend bool, chunkLevel [][]*TreeEntry,
nextLvlCount = int64(len(chunkLevel[lvl+1]) - 1)
tempEntry = chunkLevel[lvl+1][nextLvlCount]
}
- if isAppend == true && tempEntry != nil && tempEntry.updatePending == true {
+ if isAppend && tempEntry != nil && tempEntry.updatePending {
updateEntry := &TreeEntry{
level: int(lvl + 1),
branchCount: 0,
@@ -585,9 +585,9 @@ func (self *PyramidChunker) buildTree(isAppend bool, chunkLevel [][]*TreeEntry,
}
- if isAppend == false {
+ if !isAppend {
chunkWG.Wait()
- if compress == true {
+ if compress {
chunkLevel[lvl] = nil
}
}
@@ -599,7 +599,7 @@ func (self *PyramidChunker) enqueueTreeChunk(chunkLevel [][]*TreeEntry, ent *Tre
if ent != nil {
// wait for data chunks to get over before processing the tree chunk
- if last == true {
+ if last {
chunkWG.Wait()
}
@@ -612,7 +612,7 @@ func (self *PyramidChunker) enqueueTreeChunk(chunkLevel [][]*TreeEntry, ent *Tre
}
// Update or append based on weather it is a new entry or being reused
- if ent.updatePending == true {
+ if ent.updatePending {
chunkWG.Wait()
chunkLevel[ent.level][ent.index] = ent
} else {