aboutsummaryrefslogtreecommitdiffstats
path: root/swarm
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2017-12-14 17:35:49 +0800
committerJanos Guljas <janos@resenje.org>2017-12-14 17:36:12 +0800
commit47a801455966298d1d1519eebb955024c8f02b84 (patch)
tree5b8144ba4844092dc0bae599fc3314eaacf1a7b4 /swarm
parent19982f946735948478b6b7e7706f1b615f171d0d (diff)
parent3654aeaa4f87452ac5bc801a18808189595e2ef8 (diff)
downloaddexon-47a801455966298d1d1519eebb955024c8f02b84.tar
dexon-47a801455966298d1d1519eebb955024c8f02b84.tar.gz
dexon-47a801455966298d1d1519eebb955024c8f02b84.tar.bz2
dexon-47a801455966298d1d1519eebb955024c8f02b84.tar.lz
dexon-47a801455966298d1d1519eebb955024c8f02b84.tar.xz
dexon-47a801455966298d1d1519eebb955024c8f02b84.tar.zst
dexon-47a801455966298d1d1519eebb955024c8f02b84.zip
cmd/swarm: Merge branch 'master' into multiple-ens-endpoints
Fix a conflict in cmd/swarm envVarsOverride function.
Diffstat (limited to 'swarm')
-rw-r--r--swarm/api/config_test.go2
-rw-r--r--swarm/fuse/swarmfs_test.go10
-rw-r--r--swarm/storage/chunker_test.go4
-rw-r--r--swarm/storage/pyramid.go16
4 files changed, 15 insertions, 17 deletions
diff --git a/swarm/api/config_test.go b/swarm/api/config_test.go
index 2e03a610e..5636b6daf 100644
--- a/swarm/api/config_test.go
+++ b/swarm/api/config_test.go
@@ -36,7 +36,7 @@ func TestConfig(t *testing.T) {
one := NewDefaultConfig()
two := NewDefaultConfig()
- if equal := reflect.DeepEqual(one, two); equal == false {
+ if equal := reflect.DeepEqual(one, two); !equal {
t.Fatal("Two default configs are not equal")
}
diff --git a/swarm/fuse/swarmfs_test.go b/swarm/fuse/swarmfs_test.go
index 93f1d4c2f..42af36345 100644
--- a/swarm/fuse/swarmfs_test.go
+++ b/swarm/fuse/swarmfs_test.go
@@ -95,7 +95,7 @@ func mountDir(t *testing.T, api *api.Api, files map[string]fileInfo, bzzHash str
}
// Test listMounts
- if found == false {
+ if !found {
t.Fatalf("Error getting mounts information for %v: %v", mountDir, err)
}
@@ -185,10 +185,8 @@ func isDirEmpty(name string) bool {
defer f.Close()
_, err = f.Readdirnames(1)
- if err == io.EOF {
- return true
- }
- return false
+
+ return err == io.EOF
}
type testAPI struct {
@@ -388,7 +386,7 @@ func (ta *testAPI) seekInMultiChunkFile(t *testing.T) {
d.Read(contents)
finfo := files["1.txt"]
- if bytes.Compare(finfo.contents[:6024][5000:], contents) != 0 {
+ if !bytes.Equal(finfo.contents[:6024][5000:], contents) {
t.Fatalf("File seek contents mismatch")
}
d.Close()
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 {