Skip to content

Commit

Permalink
Update linter settings and update imports (#1938)
Browse files Browse the repository at this point in the history
* Fix shadowing linting setting.

* Fix linting for imports.

* Changelog entry.

* Fix imports order.
  • Loading branch information
Taztingo authored Apr 18, 2024
1 parent 5aaecbd commit 484fe50
Show file tree
Hide file tree
Showing 42 changed files with 90 additions and 63 deletions.
40 changes: 36 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,29 @@ linters-settings:

- cosmossdk.io/core
- cosmossdk.io/errors
- cosmossdk.io/log
- cosmossdk.io/math
- cosmossdk.io/store
- github.com/cosmos/go-bip39
- cosmossdk.io/x/evidence
- cosmossdk.io/x/evidence/keeper
- cosmossdk.io/x/evidence/types
- cosmossdk.io/x/feegrant
- cosmossdk.io/x/feegrant/keeper
- cosmossdk.io/x/feegrant/module
- cosmossdk.io/x/tx/signing
- cosmossdk.io/x/upgrade
- cosmossdk.io/x/upgrade/keeper
- cosmossdk.io/x/upgrade/types
- github.com/cosmos/cosmos-db
- github.com/cosmos/cosmos-sdk
- github.com/cosmos/ibc-go/v6
- github.com/cosmos/go-bip39
- github.com/cosmos/ibc-apps/modules/async-icq/v8
- github.com/cosmos/ibc-apps/modules/async-icq/v8/keeper
- github.com/cosmos/ibc-apps/modules/async-icq/v8/types
- github.com/cosmos/ibc-go/modules/capability
- github.com/cosmos/ibc-go/modules/capability/keeper
- github.com/cosmos/ibc-go/modules/capability/types
- github.com/cosmos/ibc-go/v8

- github.com/CosmWasm/wasmd
- github.com/CosmWasm/wasmvm/types
Expand All @@ -107,6 +125,8 @@ linters-settings:

- github.com/grpc-ecosystem/grpc-gateway

- github.com/hashicorp/go-metrics

- github.com/provenance-io/provenance

- github.com/rakyll/statik/fs
Expand All @@ -120,6 +140,18 @@ linters-settings:
- github.com/stretchr/testify/assert
- github.com/stretchr/testify/suite

- github.com/cometbft/cometbft/abci/types
- github.com/cometbft/cometbft/config
- github.com/cometbft/cometbft/crypto
- github.com/cometbft/cometbft/crypto/tmhash
- github.com/cometbft/cometbft/libs/cli
- github.com/cometbft/cometbft/libs/json
- github.com/cometbft/cometbft/libs/os
- github.com/cometbft/cometbft/libs/rand
- github.com/cometbft/cometbft/proto/tendermint/types
- github.com/cometbft/cometbft/rpc/jsonrpc/types
- github.com/cometbft/cometbft/types
- github.com/cometbft/cometbft/types/time
- github.com/cometbft/cometbft-db

- github.com/tendermint/tendermint
Expand All @@ -138,14 +170,14 @@ linters-settings:
sections:
- standard
- default
- prefix(github.com/tendermint)
- prefix(github.com/cometbft)
- prefix(cosmossdk.io)
- prefix(github.com/cosmos)
- prefix(github.com/provenance-io)
- blank
- dot
govet:
check-shadowing: true
shadow: true
settings:
printf:
funcs:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Remove the startup warning issued when disable-iavl-fastnode is true (we recommend keeping it as true if you already have it that way) [PR 1874](https://github.com/provenance-io/provenance/pull/1874).
* Switch to `github.com/cometbft/cometbft-db` `v0.7.0` (from `github.com/tendermint/tm-db` `v0.6.7`) [PR 1874](https://github.com/provenance-io/provenance/pull/1874).
* Allow NAV volume to exceed a marker's supply [PR 1883](https://github.com/provenance-io/provenance/pull/1883).
* Update linter settings and fix import ordering [PR 1938](https://github.com/provenance-io/provenance/pull/1938).

### Deprecated

Expand Down
15 changes: 6 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ import (
"path/filepath"
"strings"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
"github.com/spf13/viper"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

abci "github.com/cometbft/cometbft/abci/types"
cmtos "github.com/cometbft/cometbft/libs/os"

Expand All @@ -34,10 +33,6 @@ import (
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"

icq "github.com/cosmos/ibc-apps/modules/async-icq/v8"
icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v8/keeper"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v8/types"

dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -107,7 +102,9 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/gogoproto/proto"

icq "github.com/cosmos/ibc-apps/modules/async-icq/v8"
icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v8/keeper"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v8/types"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctmmigrations "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint/migrations"

attributetypes "github.com/provenance-io/provenance/x/attribute/types"
markertypes "github.com/provenance-io/provenance/x/marker/types"
metadatatypes "github.com/provenance-io/provenance/x/metadata/types"
Expand Down Expand Up @@ -400,7 +401,6 @@ func migrateMetadataOSLocatorParams(ctx sdk.Context, app *App) {
}
app.MetadataKeeper.SetOSLocatorParams(ctx, metadatatypes.OSLocatorParams{MaxUriLength: uint32(maxValueLength)})
ctx.Logger().Info("Done migrating metadata os locator params.")

}

// migrateNameParams migrates to new Name Params store
Expand Down
2 changes: 0 additions & 2 deletions cmd/provenanced/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ import (
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"

// rosettacmd "github.com/cosmos/rosetta/cmd" // TODO[1760]: rosetta

"github.com/provenance-io/provenance/app"
"github.com/provenance-io/provenance/app/params"
"github.com/provenance-io/provenance/cmd/provenanced/config"
Expand Down
2 changes: 1 addition & 1 deletion internal/antewrapper/fee_gas_meter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/hashicorp/go-metrics"

"cosmossdk.io/log"

storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"

Expand Down
5 changes: 2 additions & 3 deletions internal/handlers/msg_service_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ import (
"fmt"
"sort"

gogogrpc "github.com/cosmos/gogoproto/grpc"
"github.com/cosmos/gogoproto/proto"
"golang.org/x/exp/constraints"
"google.golang.org/grpc"
"google.golang.org/protobuf/runtime/protoiface"

"github.com/cosmos/cosmos-sdk/baseapp"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
gogogrpc "github.com/cosmos/gogoproto/grpc"
"github.com/cosmos/gogoproto/proto"

"github.com/provenance-io/provenance/internal/antewrapper"
"github.com/provenance-io/provenance/internal/helpers"
Expand Down
4 changes: 2 additions & 2 deletions internal/protocompat/protocompat.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
"fmt"
"reflect"

gogoproto "github.com/cosmos/gogoproto/proto"
"github.com/golang/protobuf/proto" // nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments.
"github.com/golang/protobuf/proto" //nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments.
"google.golang.org/grpc"
proto2 "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/runtime/protoiface"

"github.com/cosmos/cosmos-sdk/codec"
gogoproto "github.com/cosmos/gogoproto/proto"
)

var (
Expand Down
1 change: 1 addition & 0 deletions internal/provwasm/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/CosmWasm/wasmd/x/wasm/types"

sdkmath "cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
Expand Down
3 changes: 1 addition & 2 deletions testutil/mocks/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package mocks
import (
"errors"

"github.com/cosmos/gogoproto/proto"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/module"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/gogoproto/proto"
)

// This doesn't yet have injectable errors for all the possible things because they weren't needed yet.
Expand Down
3 changes: 1 addition & 2 deletions testutil/queries/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import (

"github.com/stretchr/testify/assert"

"github.com/cosmos/gogoproto/proto"

"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/testutil/network"
"github.com/cosmos/gogoproto/proto"
)

// AssertGetRequest does an HTTP get on the provided url and unmarshalls the response into the provided emptyResp.
Expand Down
1 change: 1 addition & 0 deletions x/attribute/keeper/query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"google.golang.org/grpc/status"

"cosmossdk.io/store/prefix"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"

Expand Down
3 changes: 1 addition & 2 deletions x/exchange/events.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package exchange

import (
"github.com/cosmos/gogoproto/proto"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/gogoproto/proto"
)

func NewEventOrderCreated(order OrderI) *EventOrderCreated {
Expand Down
1 change: 1 addition & 0 deletions x/exchange/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

attrtypes "github.com/provenance-io/provenance/x/attribute/types"
markertypes "github.com/provenance-io/provenance/x/marker/types"
)
Expand Down
1 change: 1 addition & 0 deletions x/exchange/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"google.golang.org/grpc/status"

"cosmossdk.io/store/prefix"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"

Expand Down
3 changes: 2 additions & 1 deletion x/exchange/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"fmt"
"math/rand"

"cosmossdk.io/core/appmodule"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"

sdkclient "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand Down
3 changes: 2 additions & 1 deletion x/hold/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"fmt"
"math/rand"

"cosmossdk.io/core/appmodule"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"

sdkclient "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand Down
3 changes: 2 additions & 1 deletion x/ibchooks/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"fmt"
"math/rand"

"cosmossdk.io/core/appmodule"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand Down
3 changes: 1 addition & 2 deletions x/ibcratelimit/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package keeper

import (
"github.com/cosmos/gogoproto/proto"

"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/gogoproto/proto"

"github.com/provenance-io/provenance/x/ibcratelimit"
)
Expand Down
2 changes: 2 additions & 0 deletions x/marker/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"regexp"

sdkmath "cosmossdk.io/math"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/provenance-io/provenance/x/marker/types"
)

Expand Down
1 change: 1 addition & 0 deletions x/marker/keeper/query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"google.golang.org/grpc/status"

"cosmossdk.io/store/prefix"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
Expand Down
3 changes: 1 addition & 2 deletions x/marker/types/accessgrant.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"fmt"
"strings"

proto "github.com/cosmos/gogoproto/proto"

sdk "github.com/cosmos/cosmos-sdk/types"
proto "github.com/cosmos/gogoproto/proto"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions x/marker/types/marker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import (
"fmt"
"strings"

proto "github.com/cosmos/gogoproto/proto"

sdkmath "cosmossdk.io/math"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
proto "github.com/cosmos/gogoproto/proto"
)

var (
Expand Down
5 changes: 2 additions & 3 deletions x/marker/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import (
"errors"
"fmt"

"github.com/cosmos/gogoproto/proto"

sdkmath "cosmossdk.io/math"

feegranttypes "cosmossdk.io/x/feegrant"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/gogoproto/proto"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
)
Expand Down
Loading

0 comments on commit 484fe50

Please sign in to comment.