From bfdd0abc37bbc5bcf0fde9bbf5c1d75b32a99413 Mon Sep 17 00:00:00 2001 From: Jaeseung Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Thu, 9 May 2024 22:46:30 +0900 Subject: [PATCH] style: replace deprecated linters with new ones (#361) --- .golangci.yml | 15 ++------------- CHANGELOG.md | 1 + app/helpers/test_helpers.go | 2 +- cli_test/test_helpers.go | 12 ++++++------ 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f2913eb6..dc5b2ce1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,35 +1,30 @@ linters: enable: - bodyclose - - deadcode - - depguard - dogsled - errcheck - goconst - gocritic - gofmt - goimports - - golint - gosec - gosimple - govet - ineffassign - misspell - - maligned - nakedret - prealloc - - scopelint - staticcheck - - structcheck - stylecheck - typecheck - unconvert - unparam - unused - - varcheck - gocyclo - whitespace - dupl + - revive + - exportloopref issues: exclude-rules: @@ -40,9 +35,6 @@ linters-settings: dogsled: # checks assignments with too many blank identifiers; default is 2 max-blank-identifiers: 7 - maligned: - # print struct with more effective memory layout or not, false by default - suggest-new: true errcheck: # report about not checking of errors in type assetions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. @@ -51,9 +43,6 @@ linters-settings: # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; # default is false: such cases aren't reported by default. check-blank: true - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0 prealloc: # XXX: we don't recommend using this linter before doing performance profiling. # For most programs usage of prealloc will be a premature optimization. diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ed39df..b7721dd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Build, CI * (build) [\#340](https://github.com/Finschia/finschia/pull/340) Set Finschia/ostracon version +* (ci) [\#361](https://github.com/Finschia/finschia/pull/361) Replace deprecated linters with new ones ### Docs diff --git a/app/helpers/test_helpers.go b/app/helpers/test_helpers.go index 7447ded9..6eb9a90f 100644 --- a/app/helpers/test_helpers.go +++ b/app/helpers/test_helpers.go @@ -42,7 +42,7 @@ var DefaultConsensusParams = &abci.ConsensusParams{ type EmptyAppOptions struct{} -func (EmptyAppOptions) Get(o string) interface{} { return nil } +func (EmptyAppOptions) Get(_ string) interface{} { return nil } func Setup(t *testing.T, isCheckTx bool, invCheckPeriod uint) *linkapp.LinkApp { t.Helper() diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index 6e2553fc..82484df0 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -444,14 +444,14 @@ func (f *Fixtures) KeysAdd(name string, flags ...string) { } // KeysAddRecover prepares fnsad keys add --recover -func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (testutil.BufferWriter, error) { +func (f *Fixtures) KeysAddRecover(name, _ string, flags ...string) (testutil.BufferWriter, error) { args := fmt.Sprintf("add --keyring-backend=test --recover %s", name) cmd := clientkeys.Commands(f.Home) return testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...)) } // KeysAddRecoverHDPath prepares fnsad keys add --recover --account --index -func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) { +func (f *Fixtures) KeysAddRecoverHDPath(name, _ string, account uint32, index uint32, flags ...string) { args := fmt.Sprintf("add --keyring-backend=test --recover %s --account=%d --index=%d", name, account, index) cmd := clientkeys.Commands(f.Home) _, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags(args, flags...)) @@ -588,7 +588,7 @@ func (f *Fixtures) TxGovSubmitParamChangeProposal( // TxGovSubmitCommunityPoolSpendProposal executes a CLI community pool spend proposal // submission. func (f *Fixtures) TxGovSubmitCommunityPoolSpendProposal( - from, proposalPath string, deposit sdk.Coin, flags ...string, + from, proposalPath string, _ sdk.Coin, flags ...string, ) (testutil.BufferWriter, error) { args := fmt.Sprintf("%s --keyring-backend=test --from=%s --node=%s", proposalPath, from, f.RPCAddr) cmd := govcli.NewCmdSubmitProposal() @@ -1048,7 +1048,7 @@ func (f *Fixtures) QueryTotalSupplyOf(denom string, flags ...string) sdk.Coin { // ___________________________________________________________________________________ // tendermint rpc -func (f *Fixtures) NetInfo(flags ...string) *ostctypes.ResultNetInfo { +func (f *Fixtures) NetInfo(_ ...string) *ostctypes.ResultNetInfo { ostc, err := osthttp.New(fmt.Sprintf("tcp://0.0.0.0:%s", f.Port), "/websocket") if err != nil { panic(fmt.Sprintf("failed to create Tendermint HTTP client: %s", err)) @@ -1088,7 +1088,7 @@ func (f *Fixtures) Status() *ostctypes.ResultStatus { // linkcli mempool // MempoolNumUnconfirmedTxs is linkcli mempool num-unconfirmed-txs -func (f *Fixtures) MempoolNumUnconfirmedTxs(flags ...string) *ostctypes.ResultUnconfirmedTxs { +func (f *Fixtures) MempoolNumUnconfirmedTxs(_ ...string) *ostctypes.ResultUnconfirmedTxs { ostc, err := osthttp.New(fmt.Sprintf("tcp://0.0.0.0:%s", f.Port), "/websocket") if err != nil { panic(fmt.Sprintf("failed to create Tendermint HTTP client: %s", err)) @@ -1186,7 +1186,7 @@ func (fg *FixtureGroup) initNodes(numberOfNodes int) { require.NoError(t, err) } } -func (fg *FixtureGroup) FinschiaStartCluster(minGasPrices string, flags ...string) { +func (fg *FixtureGroup) FinschiaStartCluster(minGasPrices string, _ ...string) { genDoc, err := osttypes.GenesisDocFromJSON(fg.genesisFileContent) require.NoError(fg.T, err)