Commit 64cb0c80 authored by liuyuhang's avatar liuyuhang

Update lint_warning处理.md

parent 2782550d
## 本地查看自己所修改模块lint warning的命令: ## 本地查看自己所修改模块lint warning的命令:
...@@ -20,6 +20,7 @@ func calcWalletPassKey() []byte { ...@@ -20,6 +20,7 @@ func calcWalletPassKey() []byte {
return []byte(keyWalletPassKey) return []byte(keyWalletPassKey)
} }
``` ```
### 2、函数注释不规范,需要按照1中方法修改 ### 2、函数注释不规范,需要按照1中方法修改
> * lint warning: comment on exported method DriverBase.GetTxsByAddr should be of the form "GetTxsByAddr ..." > * lint warning: comment on exported method DriverBase.GetTxsByAddr should be of the form "GetTxsByAddr ..."
...@@ -38,6 +39,7 @@ var ( ...@@ -38,6 +39,7 @@ var (
currentIndex int64 currentIndex int64
) )
``` ```
### 4、if else 如下格式的return,不需要加else,直接return ### 4、if else 如下格式的return,不需要加else,直接return
> * lint warning: if block ends with a return statement, so drop this else and outdent its block > * lint warning: if block ends with a return statement, so drop this else and outdent its block
``` ```
...@@ -64,6 +66,7 @@ var ( ...@@ -64,6 +66,7 @@ var (
return nil, err return nil, err
} }
``` ```
### 5、不出现this, self等参数 ### 5、不出现this, self等参数
> * lint warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" > * lint warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self"
``` ```
...@@ -73,8 +76,10 @@ func (this *UpdateInitFileTask) genInitFile() error {} ...@@ -73,8 +76,10 @@ func (this *UpdateInitFileTask) genInitFile() error {}
``` ```
func (up *UpdateInitFileTask) genInitFile() error {} func (up *UpdateInitFileTask) genInitFile() error {}
``` ```
### 6、使用自加格式 ### 6、使用自加格式
> * lint warning: should replace resp.Actual += 1 with resp.Actual++ > * lint warning: should replace resp.Actual += 1 with resp.Actual++
### 7、函数名、变量不使用带下划线(我们chain33利用加下划线实现了一些功能,因此这个暂时不需要改) ### 7、函数名、变量不使用带下划线(我们chain33利用加下划线实现了一些功能,因此这个暂时不需要改)
> * lint warning: don't use underscores in Go names; method ExecDelLocal_Transfer should be ExecDelLocalTransfer > * lint warning: don't use underscores in Go names; method ExecDelLocal_Transfer should be ExecDelLocalTransfer
...@@ -101,6 +106,7 @@ func (ws *walletStore) GetFeeAmount(minFee int64) int64 { ...@@ -101,6 +106,7 @@ func (ws *walletStore) GetFeeAmount(minFee int64) int64 {
return FeeAmount return FeeAmount
} }
``` ```
### 9、errors.New(fmt.Sprintf(...)) 这种格式替换为fmt.Errorf(...) ### 9、errors.New(fmt.Sprintf(...)) 这种格式替换为fmt.Errorf(...)
> * lint warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint) > * lint warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
``` ```
......
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