diff options
author | kiel barry <kiel.j.barry@gmail.com> | 2018-05-22 04:41:31 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-05-22 04:41:31 +0800 |
commit | 0fe47e98c4d93f952dc7415f401fd03b2664a21d (patch) | |
tree | ae30e450e853fe8a03760496b87259077a760e68 /trie/iterator.go | |
parent | 415969f534d8122e717e18abafdc8ec7bb913a84 (diff) | |
download | dexon-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar dexon-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.gz dexon-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.bz2 dexon-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.lz dexon-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.xz dexon-0fe47e98c4d93f952dc7415f401fd03b2664a21d.tar.zst dexon-0fe47e98c4d93f952dc7415f401fd03b2664a21d.zip |
trie: fixes to comply with golint (#16771)
Diffstat (limited to 'trie/iterator.go')
-rw-r--r-- | trie/iterator.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/trie/iterator.go b/trie/iterator.go index 3bae8e186..64110c6d9 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -99,8 +99,8 @@ type nodeIterator struct { err error // Failure set in case of an internal error in the iterator } -// iteratorEnd is stored in nodeIterator.err when iteration is done. -var iteratorEnd = errors.New("end of iteration") +// errIteratorEnd is stored in nodeIterator.err when iteration is done. +var errIteratorEnd = errors.New("end of iteration") // seekError is stored in nodeIterator.err if the initial seek has failed. type seekError struct { @@ -162,7 +162,7 @@ func (it *nodeIterator) Path() []byte { } func (it *nodeIterator) Error() error { - if it.err == iteratorEnd { + if it.err == errIteratorEnd { return nil } if seek, ok := it.err.(seekError); ok { @@ -176,7 +176,7 @@ func (it *nodeIterator) Error() error { // sets the Error field to the encountered failure. If `descend` is false, // skips iterating over any subnodes of the current node. func (it *nodeIterator) Next(descend bool) bool { - if it.err == iteratorEnd { + if it.err == errIteratorEnd { return false } if seek, ok := it.err.(seekError); ok { @@ -201,8 +201,8 @@ func (it *nodeIterator) seek(prefix []byte) error { // Move forward until we're just before the closest match to key. for { state, parentIndex, path, err := it.peek(bytes.HasPrefix(key, it.path)) - if err == iteratorEnd { - return iteratorEnd + if err == errIteratorEnd { + return errIteratorEnd } else if err != nil { return seekError{prefix, err} } else if bytes.Compare(path, key) >= 0 { @@ -246,7 +246,7 @@ func (it *nodeIterator) peek(descend bool) (*nodeIteratorState, *int, []byte, er // No more child nodes, move back up. it.pop() } - return nil, nil, nil, iteratorEnd + return nil, nil, nil, errIteratorEnd } func (st *nodeIteratorState) resolve(tr *Trie, path []byte) error { |