Skip to content

Commit

Permalink
Replace vet with golangci lint govet (cosmos#4277)
Browse files Browse the repository at this point in the history
Drop go vet in favor of golangci-lint govet check.

Fix golangci-lint warnings.

Upgrade golangci-lint.
  • Loading branch information
Alessio Treglia authored May 6, 2019
1 parent 5060187 commit 06f7b21
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 20 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ linters:
- ineffassign
- unconvert
- misspell
- govet
linters-settings:
gocyclo:
min-complexity: 11
errcheck:
ignore: fmt:.*,io/ioutil:^Read.*,github.com/spf13/cobra:MarkFlagRequired,github.com/spf13/viper:BindPFlag
golint:
min-confidence: 1.1
issues:
exclude:
- composite
run:
tests: false
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ test_cover:
lint: tools ci-lint
ci-lint:
golangci-lint run
go vet -composites=false -tests=false ./...
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s
go mod verify

Expand Down
5 changes: 0 additions & 5 deletions client/rpc/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ func NodeSyncingRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
}

syncing := status.SyncInfo.CatchingUp
if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}

if _, err := w.Write([]byte(strconv.FormatBool(syncing))); err != nil {
log.Printf("could not write response: %v", err)
}
Expand Down
1 change: 0 additions & 1 deletion cmd/gaia/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ check-all: check-unit check-race check-cover check-build
lint: ci-lint
ci-lint:
golangci-lint run
go vet -composites=false -tests=false ./...
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s
go mod verify

Expand Down
2 changes: 1 addition & 1 deletion cmd/gaia/lcd_test/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/spf13/viper"
"github.com/stretchr/testify/require"
"github.com/tendermint/go-amino"
amino "github.com/tendermint/go-amino"

"github.com/cosmos/cosmos-sdk/client"
clientkeys "github.com/cosmos/cosmos-sdk/client/keys"
Expand Down
2 changes: 1 addition & 1 deletion contrib/devtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif

GOPATH ?= $(shell $(GO) env GOPATH)
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com
GOLANGCI_LINT_VERSION := v1.15.0
GOLANGCI_LINT_VERSION := v1.16.0
GOLANGCI_LINT_HASHSUM := ac897cadc180bf0c1a4bf27776c410debad27205b22856b861d41d39d06509cf

###
Expand Down
4 changes: 3 additions & 1 deletion crypto/ledger_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ package crypto

import (
"fmt"

"github.com/btcsuite/btcd/btcec"
"github.com/pkg/errors"

bip39 "github.com/cosmos/go-bip39"

"github.com/cosmos/cosmos-sdk/crypto/keys/hd"
"github.com/cosmos/cosmos-sdk/tests"
"github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/go-bip39"

secp256k1 "github.com/tendermint/btcd/btcec"
"github.com/tendermint/tendermint/crypto"
Expand Down
3 changes: 2 additions & 1 deletion x/auth/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"bytes"
"encoding/hex"
"fmt"
"github.com/tendermint/tendermint/crypto/ed25519"
"time"

"github.com/tendermint/tendermint/crypto/ed25519"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/multisig"
"github.com/tendermint/tendermint/crypto/secp256k1"
Expand Down
4 changes: 2 additions & 2 deletions x/gov/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ func (sup SoftwareUpgradeProposal) String() string {
}

var validProposalTypes = map[string]struct{}{
ProposalTypeText: struct{}{},
ProposalTypeSoftwareUpgrade: struct{}{},
ProposalTypeText: {},
ProposalTypeSoftwareUpgrade: {},
}

// RegisterProposalType registers a proposal type. It will panic if the type is
Expand Down
5 changes: 3 additions & 2 deletions x/mint/client/module_client.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package client

import (
"github.com/spf13/cobra"
amino "github.com/tendermint/go-amino"

sdkclient "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/x/mint"
"github.com/cosmos/cosmos-sdk/x/mint/client/cli"
"github.com/spf13/cobra"
"github.com/tendermint/go-amino"
)

type ModuleClient struct {
Expand Down
6 changes: 3 additions & 3 deletions x/params/simulation/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ var paramChangePool = []simParamChange{
"MinSignedPerWindow",
"",
func(r *rand.Rand) string {
return fmt.Sprintf("\"%d\"", simulation.ModuleParamSimulator["MinSignedPerWindow"](r).(sdk.Dec))
return fmt.Sprintf("\"%s\"", simulation.ModuleParamSimulator["MinSignedPerWindow"](r).(sdk.Dec))
},
},
{
"slashing",
"SlashFractionDowntime",
"",
func(r *rand.Rand) string {
return fmt.Sprintf("\"%d\"", simulation.ModuleParamSimulator["SlashFractionDowntime"](r).(sdk.Dec))
return fmt.Sprintf("\"%s\"", simulation.ModuleParamSimulator["SlashFractionDowntime"](r).(sdk.Dec))
},
},
// minting parameters
Expand All @@ -76,7 +76,7 @@ var paramChangePool = []simParamChange{
"InflationRateChange",
"",
func(r *rand.Rand) string {
return fmt.Sprintf("\"%d\"", simulation.ModuleParamSimulator["InflationRateChange"](r).(sdk.Dec))
return fmt.Sprintf("\"%s\"", simulation.ModuleParamSimulator["InflationRateChange"](r).(sdk.Dec))
},
},
// auth parameters
Expand Down
4 changes: 2 additions & 2 deletions x/slashing/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func (p Params) String() string {
SignedBlocksWindow: %d
MinSignedPerWindow: %s
DowntimeJailDuration: %s
SlashFractionDoubleSign: %d
SlashFractionDowntime: %d`, p.MaxEvidenceAge,
SlashFractionDoubleSign: %s
SlashFractionDowntime: %s`, p.MaxEvidenceAge,
p.SignedBlocksWindow, p.MinSignedPerWindow,
p.DowntimeJailDuration, p.SlashFractionDoubleSign,
p.SlashFractionDowntime)
Expand Down

0 comments on commit 06f7b21

Please sign in to comment.