Skip to content

Commit

Permalink
address linters
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteHerrmann committed May 7, 2024
1 parent 5501795 commit 209c518
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
25 changes: 5 additions & 20 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,21 @@ linters:
disable:
# unwanted linters
- depguard # would have loved to add but doesn't seem to work correctly
- err113
- exhaustruct
- gomoddirectives
- goerr113
- gomnd
# discontinued linters
- deadcode
- exhaustivestruct
- gochecknoglobals
- gochecknoinits
- golint
- ifshort
- interfacer
- nosnakecase
- maligned
- scopelint
- structcheck
- varcheck
- gomnd
- gomoddirectives
- mnd

linters-settings:
dogsled:
max-blank-identifiers: 3
gofumpt:
lang-version: "1.21"
maligned:
suggest-new: true
max-blank-identifiers: 1
misspell:
locale: US
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: true
require-specific: true
varnamelen:
Expand Down
5 changes: 3 additions & 2 deletions gov/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func SubmitAllVotesForProposal(bin *utils.Binary, proposalID int) error {
}

if err := utils.WaitNBlocks(bin, 1); err != nil {
return err
return errors.Wrapf(err, "error waiting for blocks")
}

bin.Logger.Info().Msgf("voting for proposal %d", proposalID)
Expand All @@ -55,7 +55,8 @@ func SubmitAllVotesForProposal(bin *utils.Binary, proposalID int) error {
bin.Logger.Error().Msgf("could not vote using key %s: %v", acc.Name, err)
} else {
bin.Logger.Info().Msgf("voted using key %s", acc.Name)
successfulVotes += 1

successfulVotes++
}
}

Expand Down
8 changes: 4 additions & 4 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ type BinaryCmdArgs struct {
func ExecuteBinaryCmd(bin *Binary, args BinaryCmdArgs) (string, error) {
fullCommand := args.Subcommand

fmt.Println("Command: ", bin.Config.Appd, strings.Join(fullCommand, " "))
//#nosec G204 // no risk of injection here because only internal commands are passed
cmd := exec.Command(bin.Config.Appd, fullCommand...)

Expand Down Expand Up @@ -192,21 +191,22 @@ func GetTxHashFromTxResponse(cdc *codec.ProtoCodec, out string) (string, error)

// WaitNBlocks waits for the specified amount of blocks being produced
// on the connected network.
func WaitNBlocks(bin *Binary, n int) error {
func WaitNBlocks(bin *Binary, nBlocks int) error {
currentHeight, err := GetCurrentHeight(bin)
if err != nil {
return err
}

for {
bin.Logger.Debug().Msgf("waiting for %d blocks\n", n)
bin.Logger.Debug().Msgf("waiting for %d blocks\n", nBlocks)
time.Sleep(2 * time.Second)

height, err := GetCurrentHeight(bin)
if err != nil {
return err
}

if height >= currentHeight+n {
if height >= currentHeight+nBlocks {
break
}
}
Expand Down

0 comments on commit 209c518

Please sign in to comment.