From b2835eb78b721699757e772aa1876b7112afc255 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 8 Apr 2024 20:12:10 +0200 Subject: [PATCH] chore: linting fixes (#19978) --- client/cmd.go | 2 +- client/config/config.go | 2 +- client/v2/autocli/common_test.go | 2 +- server/start.go | 2 +- store/db/rocksdb_noflag.go | 26 ------------------- store/root/migrate_test.go | 2 +- tests/integration/server/grpc/server_test.go | 2 +- tests/starship/tests/suite.go | 2 +- tools/hubl/internal/load.go | 2 +- x/accounts/defaults/lockup/lockup.go | 5 ++-- x/accounts/defaults/lockup/protov2_wrapper.go | 6 +++-- 11 files changed, 15 insertions(+), 38 deletions(-) diff --git a/client/cmd.go b/client/cmd.go index 61412200fd5f..e817649d24dc 100644 --- a/client/cmd.go +++ b/client/cmd.go @@ -168,7 +168,7 @@ func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Cont }))) } - grpcClient, err := grpc.Dial(grpcURI, dialOpts...) + grpcClient, err := grpc.NewClient(grpcURI, dialOpts...) if err != nil { return Context{}, err } diff --git a/client/config/config.go b/client/config/config.go index ae8cbb70584a..893ddd7df886 100644 --- a/client/config/config.go +++ b/client/config/config.go @@ -175,7 +175,7 @@ func getGRPCClient(grpcConfig GRPCConfig) (*grpc.ClientConn, error) { } dialOptions := []grpc.DialOption{transport} - grpcClient, err := grpc.Dial(grpcConfig.Address, dialOptions...) + grpcClient, err := grpc.NewClient(grpcConfig.Address, dialOptions...) if err != nil { return nil, fmt.Errorf("failed to dial gRPC server at %s: %w", grpcConfig.Address, err) } diff --git a/client/v2/autocli/common_test.go b/client/v2/autocli/common_test.go index 2850abc226f3..9e8613be07ca 100644 --- a/client/v2/autocli/common_test.go +++ b/client/v2/autocli/common_test.go @@ -49,7 +49,7 @@ func initFixture(t *testing.T) *fixture { } }() - clientConn, err := grpc.Dial(listener.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) + clientConn, err := grpc.NewClient(listener.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NilError(t, err) encodingConfig := moduletestutil.MakeTestEncodingConfig(testutil.CodecOptions{}, bank.AppModule{}) diff --git a/server/start.go b/server/start.go index a3cb688df669..cfed5a393a12 100644 --- a/server/start.go +++ b/server/start.go @@ -473,7 +473,7 @@ func startGrpcServer( } // if gRPC is enabled, configure gRPC client for gRPC gateway - grpcClient, err := grpc.Dial( + grpcClient, err := grpc.NewClient( config.Address, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultCallOptions( diff --git a/store/db/rocksdb_noflag.go b/store/db/rocksdb_noflag.go index b51ff681a11a..100171a077ce 100644 --- a/store/db/rocksdb_noflag.go +++ b/store/db/rocksdb_noflag.go @@ -86,29 +86,3 @@ func (itr *rocksDBIterator) Close() error { func (itr *rocksDBIterator) assertIsValid() { panic("rocksdb must be built with -tags rocksdb") } - -type rocksDBBatch struct{} - -func (b *rocksDBBatch) Set(key, value []byte) error { - panic("rocksdb must be built with -tags rocksdb") -} - -func (b *rocksDBBatch) Delete(key []byte) error { - panic("rocksdb must be built with -tags rocksdb") -} - -func (b *rocksDBBatch) Write() error { - panic("rocksdb must be built with -tags rocksdb") -} - -func (b *rocksDBBatch) WriteSync() error { - panic("rocksdb must be built with -tags rocksdb") -} - -func (b *rocksDBBatch) Close() error { - panic("rocksdb must be built with -tags rocksdb") -} - -func (b *rocksDBBatch) GetByteSize() (int, error) { - panic("rocksdb must be built with -tags rocksdb") -} diff --git a/store/root/migrate_test.go b/store/root/migrate_test.go index 38f4568f21d5..5999fd053e66 100644 --- a/store/root/migrate_test.go +++ b/store/root/migrate_test.go @@ -88,7 +88,7 @@ func (s *MigrateStoreTestSuite) TestMigrateState() { s.Require().NoError(err) // start the migration process - s.rootStore.StartMigration() + s.Require().NoError(s.rootStore.StartMigration()) // continue to apply changeset against the original store latestVersion := originalLatestVersion + 1 diff --git a/tests/integration/server/grpc/server_test.go b/tests/integration/server/grpc/server_test.go index 925805dbada4..6ea705f42056 100644 --- a/tests/integration/server/grpc/server_test.go +++ b/tests/integration/server/grpc/server_test.go @@ -52,7 +52,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(err) val0 := s.network.GetValidators()[0] - s.conn, err = grpc.Dial( + s.conn, err = grpc.NewClient( val0.GetAppConfig().GRPC.Address, grpc.WithInsecure(), //nolint:staticcheck // ignore SA1019, we don't need to use a secure connection for tests grpc.WithDefaultCallOptions(grpc.ForceCodec(codec.NewProtoCodec(s.cfg.InterfaceRegistry).GRPCCodec())), diff --git a/tests/starship/tests/suite.go b/tests/starship/tests/suite.go index e9602e215e77..bc9644a29b0a 100644 --- a/tests/starship/tests/suite.go +++ b/tests/starship/tests/suite.go @@ -55,7 +55,7 @@ func (s *TestSuite) SetupTest() { s.cdc = encodingConfig - grpcConn, err := grpc.Dial( + grpcConn, err := grpc.NewClient( fmt.Sprintf("127.0.0.1:%d", config.GetChain(chainID).Ports.Grpc), grpc.WithInsecure(), //nolint:staticcheck // ignore SA1019, we don't need to use a secure connection for tests grpc.WithDefaultCallOptions(grpc.ForceCodec(codec.NewProtoCodec(s.cdc.InterfaceRegistry).GRPCCodec()))) diff --git a/tools/hubl/internal/load.go b/tools/hubl/internal/load.go index eea3f62b0717..9b0069ff6cc5 100644 --- a/tools/hubl/internal/load.go +++ b/tools/hubl/internal/load.go @@ -174,7 +174,7 @@ func (c *ChainInfo) OpenClient() (*grpc.ClientConn, error) { } var err error - c.client, err = grpc.Dial(endpoint.Endpoint, grpc.WithTransportCredentials(creds)) + c.client, err = grpc.NewClient(endpoint.Endpoint, grpc.WithTransportCredentials(creds)) if err != nil { res = errors.Join(res, err) continue diff --git a/x/accounts/defaults/lockup/lockup.go b/x/accounts/defaults/lockup/lockup.go index c3daa2eb48f7..71e7687c8428 100644 --- a/x/accounts/defaults/lockup/lockup.go +++ b/x/accounts/defaults/lockup/lockup.go @@ -6,6 +6,8 @@ import ( "fmt" "time" + "github.com/cosmos/gogoproto/proto" + "cosmossdk.io/collections" collcodec "cosmossdk.io/collections/codec" "cosmossdk.io/core/address" @@ -15,9 +17,8 @@ import ( "cosmossdk.io/x/accounts/accountstd" lockuptypes "cosmossdk.io/x/accounts/defaults/lockup/types" banktypes "cosmossdk.io/x/bank/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/gogoproto/proto" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) diff --git a/x/accounts/defaults/lockup/protov2_wrapper.go b/x/accounts/defaults/lockup/protov2_wrapper.go index 782f9e301594..caee0c60398f 100644 --- a/x/accounts/defaults/lockup/protov2_wrapper.go +++ b/x/accounts/defaults/lockup/protov2_wrapper.go @@ -1,12 +1,14 @@ package lockup import ( + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/runtime/protoiface" + bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" stakingv1beta1 "cosmossdk.io/api/cosmos/staking/v1beta1" + sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/runtime/protoiface" ) type ProtoMsg = protoiface.MessageV1