diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 00000000..84646260 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,27 @@ +# see: https://github.com/golangci/golangci-lint-action +name: golangci-lint +on: + push: + tags: + - v* + branches: + - master + - main + pull_request: +permissions: + contents: read +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.17 + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + # TODO: 扩大 go-lint 检查范围 + working-directory: kernel/engines/xuperos/xtoken diff --git a/bcs/consensus/single/single.go b/bcs/consensus/single/single.go index 5435a595..af07726c 100644 --- a/bcs/consensus/single/single.go +++ b/bcs/consensus/single/single.go @@ -110,7 +110,7 @@ func (s *SingleConsensus) CheckMinerMatch(ctx xcontext.XContext, block cctx.Bloc return false, err } chkResult, _ := s.ctx.Crypto.VerifyAddressUsingPublicKey(string(block.GetProposer()), k) - if chkResult == false { + if !chkResult { ctx.GetLog().Warn("Single::CheckMinerMatch::address is not match publickey") return false, err } diff --git a/bcs/consensus/single/single_test.go b/bcs/consensus/single/single_test.go index c2290664..56249e25 100644 --- a/bcs/consensus/single/single_test.go +++ b/bcs/consensus/single/single_test.go @@ -62,9 +62,15 @@ func TestNewSingleConsensus(t *testing.T) { if i := NewSingleConsensus(*cCtx, getWrongConsensusConf()); i != nil { t.Error("NewSingleConsensus check name error") } - i.Stop() - i.Start() - i.ProcessBeforeMiner(0, time.Now().UnixNano()) + if err := i.Stop(); err != nil { + t.Fatal(err) + } + if err := i.Start(); err != nil { + t.Fatal(err) + } + if _, _, err := i.ProcessBeforeMiner(0, time.Now().UnixNano()); err != nil { + t.Fatal(err) + } cCtx.XLog = nil i = NewSingleConsensus(*cCtx, conf) if i != nil { diff --git a/kernel/engines/xuperos/xtoken/README.md b/kernel/engines/xuperos/xtoken/README.md index fcacc593..4c404fed 100644 --- a/kernel/engines/xuperos/xtoken/README.md +++ b/kernel/engines/xuperos/xtoken/README.md @@ -1 +1 @@ -XToken 系统合约主要功能分为两部分:创建ERC20标准的代币,和支持提案投票功能。 \ No newline at end of file +XToken 系统合约主要功能分为两部分:创建ERC20标准的代币,和支持提案投票功能。