Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bookmark
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuyuhang
bookmark
Commits
a21b473e
Commit
a21b473e
authored
Nov 19, 2018
by
liuyuhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update linter_warning处理.md
parent
5f8c6a85
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
3 deletions
+62
-3
linter_warning处理.md
linter_warning处理.md
+62
-3
No files found.
linter_warning处理.md
View file @
a21b473e
## 本地
查看自己所修改模块golint warning的命令:
## 本地
查看自己所修改模块golint warning的命令:
...
...
@@ -6,6 +6,10 @@
> * go vet plugin/...
> * go vet plugin/dapp/...
## 本地查看自己所修改模块ineffassign warning的命令:
> * ineffassign plugin/...
> * go vet plugin/dapp/...
## golint warning修改方法:
### 1、导出结构体、变量、常量、函数需加注释
> * lint warning: exported const HashSize should have comment or be unexported
...
...
@@ -128,4 +132,59 @@ func (ws *walletStore) GetFeeAmount(minFee int64) int64 {
if index < 0 {
return fmt.Errorf("Action %s Not Existed", this.ActionName)
}
```
\ No newline at end of file
```
## ineffassign warning修改方法:
### 1、导出结构体、变量、常量、函数需加注释
> * ineffectual assignment to ty
```
func (acc *DB) depositBalance(execaddr string, amount int64) (*types.Receipt, error) {
ty := int32(types.TyLogDeposit)
ty = types.TyLogDeposit
log1 := &types.ReceiptLog{
Ty: ty,
Log: types.Encode(receiptBalance),
}
kv := acc.GetKVSet(acc1)
return &types.Receipt{
Ty: types.ExecOk,
KV: kv,
Logs: []*types.ReceiptLog{log1},
}, nil
}
```
改为
```
func (acc *DB) depositBalance(execaddr string, amount int64) (*types.Receipt, error) {
ty := int32(types.TyLogDeposit)
ty = types.TyLogDeposit
log1 := &types.ReceiptLog{
Ty: int32(types.TyLogDeposit),
Log: types.Encode(receiptBalance),
}
kv := acc.GetKVSet(acc1)
return &types.Receipt{
Ty: types.ExecOk,
KV: kv,
Logs: []*types.ReceiptLog{log1},
}, nil
}
```
或者
```
ty := int32(types.TyLogDeposit)
_ = ty
ty = types.TyLogDeposit
log1 := &types.ReceiptLog{
Ty: ty,
Log: types.Encode(receiptBalance),
}
kv := acc.GetKVSet(acc1)
return &types.Receipt{
Ty: types.ExecOk,
KV: kv,
Logs: []*types.ReceiptLog{log1},
}, nil
}
```
推荐第一种
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment