Commit a272ebad authored by liuyuhang's avatar liuyuhang

Update linter_warning处理.md

parent d437623f
## 本地查看自己所修改模块golint warning的命令: ## 本地查看自己所修改模块golint warning的命令:
...@@ -190,4 +190,54 @@ func (acc *DB) depositBalance(execaddr string, amount int64) (*types.Receipt, er ...@@ -190,4 +190,54 @@ func (acc *DB) depositBalance(execaddr string, amount int64) (*types.Receipt, er
}, nil }, nil
} }
``` ```
推荐第一种 推荐第一种
\ No newline at end of file
### 2、
> * ineffectual assignment to end
```
func maxSubList(list []time.Duration) (sub []time.Duration) {
start := 0
end := 0
if len(list) == 0 {
return list
}
for i := 0; i < len(list); i++ {
.....
if abs(nextheight-list[i]) > time.Millisecond*100 {
end = i + 1
if len(sub) < (end - start) {
sub = list[start:end]
}
start = i + 1
end = i + 1
} else {
end = i + 1
}
}
}
```
改为
```
func maxSubList(list []time.Duration) (sub []time.Duration) {
if len(list) == 0 {
return list
}
for i := 0; i < len(list); i++ {
.....
var start int
var end int
if abs(nextheight-list[i]) > time.Millisecond*100 {
end = i + 1
if len(sub) < (end - start) {
sub = list[start:end]
}
start = i + 1
end = i + 1
} else {
end = i + 1
}
}
}
```
\ No newline at end of file
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