Commit 1c0c6d72 authored by 陈德海's avatar 陈德海

fix linter

parent 5887e326
...@@ -35,6 +35,7 @@ type skipListNode struct { ...@@ -35,6 +35,7 @@ type skipListNode struct {
Value *SkipValue Value *SkipValue
} }
// SkipList 跳跃表
type SkipList struct { type SkipList struct {
header, tail *skipListNode header, tail *skipListNode
findcount int findcount int
...@@ -42,6 +43,7 @@ type SkipList struct { ...@@ -42,6 +43,7 @@ type SkipList struct {
level int level int
} }
// SkipListIterator 跳跃表迭代器
type SkipListIterator struct { type SkipListIterator struct {
list *SkipList list *SkipList
node *skipListNode node *skipListNode
...@@ -217,10 +219,10 @@ func (sl *SkipList) Delete(value *SkipValue) int { ...@@ -217,10 +219,10 @@ func (sl *SkipList) Delete(value *SkipValue) int {
} }
// Print 测试用的输出函数 // Print 测试用的输出函数
func (l *SkipList) Print() { func (sl *SkipList) Print() {
if l.count > 0 { if sl.count > 0 {
r := l.header r := sl.header
for i := l.level - 1; i >= 0; i-- { for i := sl.level - 1; i >= 0; i-- {
e := r.next[i] e := r.next[i]
//fmt.Print(i) //fmt.Print(i)
for e != nil { for e != nil {
...@@ -238,8 +240,8 @@ func (l *SkipList) Print() { ...@@ -238,8 +240,8 @@ func (l *SkipList) Print() {
} }
//Walk 遍历整个结构,如果cb 返回false 那么停止遍历 //Walk 遍历整个结构,如果cb 返回false 那么停止遍历
func (lm *SkipList) Walk(cb func(value interface{}) bool) { func (sl *SkipList) Walk(cb func(value interface{}) bool) {
for e := lm.header.Next(); e != nil; e = e.Next() { for e := sl.header.Next(); e != nil; e = e.Next() {
if cb == nil { if cb == nil {
return return
} }
......
...@@ -32,6 +32,7 @@ type skipListNode struct { ...@@ -32,6 +32,7 @@ type skipListNode struct {
Value *SkipValue Value *SkipValue
} }
// SkipList 跳跃表
type SkipList struct { type SkipList struct {
header, tail *skipListNode header, tail *skipListNode
findcount int findcount int
...@@ -39,6 +40,7 @@ type SkipList struct { ...@@ -39,6 +40,7 @@ type SkipList struct {
level int level int
} }
// SkipListIterator 跳跃表迭代器
type SkipListIterator struct { type SkipListIterator struct {
list *SkipList list *SkipList
node *skipListNode node *skipListNode
...@@ -214,10 +216,10 @@ func (sl *SkipList) Delete(value *SkipValue) int { ...@@ -214,10 +216,10 @@ func (sl *SkipList) Delete(value *SkipValue) int {
} }
// Print 测试用的输出函数 // Print 测试用的输出函数
func (l *SkipList) Print() { func (sl *SkipList) Print() {
if l.count > 0 { if sl.count > 0 {
r := l.header r := sl.header
for i := l.level - 1; i >= 0; i-- { for i := sl.level - 1; i >= 0; i-- {
e := r.next[i] e := r.next[i]
//fmt.Print(i) //fmt.Print(i)
for e != nil { for e != nil {
...@@ -235,8 +237,8 @@ func (l *SkipList) Print() { ...@@ -235,8 +237,8 @@ func (l *SkipList) Print() {
} }
//Walk 遍历整个结构,如果cb 返回false 那么停止遍历 //Walk 遍历整个结构,如果cb 返回false 那么停止遍历
func (lm *SkipList) Walk(cb func(value interface{}) bool) { func (sl *SkipList) Walk(cb func(value interface{}) bool) {
for e := lm.header.Next(); e != nil; e = e.Next() { for e := sl.header.Next(); e != nil; e = e.Next() {
if cb == nil { if cb == nil {
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment