Commit 4cc4256c authored by liuyuhang's avatar liuyuhang

modify md file

parent 91ee2d99
## 本地查看自己所修改模块lint warning的命令: ## 本地查看自己所修改模块lint warning的命令:
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
### 1、导出结构体、变量、常量、函数需加注释 ### 1、导出结构体、变量、常量、函数需加注释
> * lint warning: exported const HashSize should have comment or be unexported > * lint warning: exported const HashSize should have comment or be unexported
``` ```
注释格式:
const ( const (
// KeyWalletPassKey ....... // KeyWalletPassKey .......
KeyWalletPassKey = "WalletPassKey" KeyWalletPassKey = "WalletPassKey"
...@@ -15,7 +14,7 @@ func CalcWalletPassKey() []byte { ...@@ -15,7 +14,7 @@ func CalcWalletPassKey() []byte {
return []byte(keyWalletPassKey) return []byte(keyWalletPassKey)
} }
``` ```
> **注:如果是某些函数或者变量没有必要exported的话,首字母改为小写就不需要注释了** **注:如果是某些函数或者变量没有必要exported的话,首字母改为小写就不需要注释了**
``` ```
func calcWalletPassKey() []byte { func calcWalletPassKey() []byte {
return []byte(keyWalletPassKey) return []byte(keyWalletPassKey)
...@@ -31,7 +30,9 @@ var ( ...@@ -31,7 +30,9 @@ var (
currentHeight int64 = 0 currentHeight int64 = 0
currentIndex int64 = 0 currentIndex int64 = 0
) )
改为 ```
改为:
```
var ( var (
currentHeight int64 currentHeight int64
currentIndex int64 currentIndex int64
...@@ -50,7 +51,9 @@ var ( ...@@ -50,7 +51,9 @@ var (
return nil, err return nil, err
} }
} }
```
改为: 改为:
```
if head == nil { if head == nil {
blockhight := chain.GetBlockHeight() blockhight := chain.GetBlockHeight()
tmpHead, err := chain.blockStore.GetBlockHeaderByHeight(blockhight) tmpHead, err := chain.blockStore.GetBlockHeaderByHeight(blockhight)
...@@ -65,7 +68,9 @@ var ( ...@@ -65,7 +68,9 @@ var (
> * 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"
``` ```
func (this *UpdateInitFileTask) genInitFile() error {} func (this *UpdateInitFileTask) genInitFile() error {}
```
改为: 改为:
```
func (up *UpdateInitFileTask) genInitFile() error {} func (up *UpdateInitFileTask) genInitFile() error {}
``` ```
### 6、使用自加格式 ### 6、使用自加格式
...@@ -84,7 +89,9 @@ func (store *walletStore) GetFeeAmount(minFee int64) int64 { ...@@ -84,7 +89,9 @@ func (store *walletStore) GetFeeAmount(minFee int64) int64 {
.... ....
return FeeAmount return FeeAmount
} }
```
改为: 改为:
```
func (ws *walletStore) SetFeeAmount(FeeAmount int64) error { func (ws *walletStore) SetFeeAmount(FeeAmount int64) error {
.... ....
return nil return nil
...@@ -101,7 +108,9 @@ func (ws *walletStore) GetFeeAmount(minFee int64) int64 { ...@@ -101,7 +108,9 @@ func (ws *walletStore) GetFeeAmount(minFee int64) int64 {
if index < 0 { if index < 0 {
return errors.New(fmt.Sprintf("Action %s Not Existed", this.ActionName)) return errors.New(fmt.Sprintf("Action %s Not Existed", this.ActionName))
} }
```
改为: 改为:
```
index := strings.Index(context, this.ActionName) index := strings.Index(context, this.ActionName)
if index < 0 { if index < 0 {
return fmt.Errorf("Action %s Not Existed", this.ActionName) return fmt.Errorf("Action %s Not Existed", this.ActionName)
......
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