chore: bump golangci-lint and fix all linting issues (#21761)

This commit is contained in:
Julien Robert
2024-09-16 19:11:19 +00:00
committed by GitHub
parent 52ba264c80
commit cbdfd9bdfa
186 changed files with 114 additions and 455 deletions
@@ -3,10 +3,9 @@ package gogoreflection
import (
"reflect"
_ "github.com/cosmos/cosmos-proto" // look above
_ "github.com/cosmos/gogoproto/gogoproto" // required so it does register the gogoproto file descriptor
gogoproto "github.com/cosmos/gogoproto/proto"
_ "github.com/cosmos/cosmos-proto" // look above
"github.com/golang/protobuf/proto" //nolint:staticcheck // migrate in a future pr
)
@@ -42,12 +41,12 @@ func getExtension(extID int32, m proto.Message) *gogoproto.ExtensionDesc {
for id, desc := range proto.RegisteredExtensions(m) { //nolint:staticcheck // keep for backward compatibility
if id == extID {
return &gogoproto.ExtensionDesc{
ExtendedType: desc.ExtendedType, //nolint:staticcheck // keep for backward compatibility
ExtensionType: desc.ExtensionType, //nolint:staticcheck // keep for backward compatibility
Field: desc.Field, //nolint:staticcheck // keep for backward compatibility
Name: desc.Name, //nolint:staticcheck // keep for backward compatibility
Tag: desc.Tag, //nolint:staticcheck // keep for backward compatibility
Filename: desc.Filename, //nolint:staticcheck // keep for backward compatibility
ExtendedType: desc.ExtendedType,
ExtensionType: desc.ExtensionType,
Field: desc.Field,
Name: desc.Name,
Tag: desc.Tag,
Filename: desc.Filename,
}
}
}
@@ -188,7 +188,7 @@ func fqn(prefix, name string) string {
// fileDescForType gets the file descriptor for the given type.
// The given type should be a proto message.
func (s *serverReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDescriptorProto, error) {
m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(protoMessage)
m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(protoMessage)
if !ok {
return nil, fmt.Errorf("failed to create message from type: %v", st)
}
@@ -236,7 +236,7 @@ func typeForName(name string) (reflect.Type, error) {
}
func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescriptorProto, error) {
m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(gogoproto.Message)
m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(gogoproto.Message)
if !ok {
return nil, fmt.Errorf("failed to create message from type: %v", st)
}
@@ -251,7 +251,7 @@ func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescripto
}
func (s *serverReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) {
m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(gogoproto.Message)
m, ok := reflect.Zero(reflect.PointerTo(st)).Interface().(gogoproto.Message)
if !ok {
return nil, fmt.Errorf("failed to create message from type: %v", st)
}
+1 -1
View File
@@ -17,7 +17,7 @@ import (
// GlobalLabels defines the set of global labels that will be applied to all
// metrics emitted using the telemetry package function wrappers.
var GlobalLabels = []metrics.Label{} // nolint: ignore // false positive
var GlobalLabels = []metrics.Label{} //nolint: ignore // false positive
// NewLabel creates a new instance of Label with name and value
func NewLabel(name, value string) metrics.Label {
+1 -9
View File
@@ -334,9 +334,6 @@ func TestConsensus_ExtendVote(t *testing.T) {
Block: &v1.BlockParams{
MaxGas: 5000000,
},
Abci: &v1.ABCIParams{
VoteExtensionsEnableHeight: 2,
},
Feature: &v1.FeatureParams{
VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2},
},
@@ -376,9 +373,6 @@ func TestConsensus_VerifyVoteExtension(t *testing.T) {
Block: &v1.BlockParams{
MaxGas: 5000000,
},
Abci: &v1.ABCIParams{
VoteExtensionsEnableHeight: 2,
},
Feature: &v1.FeatureParams{
VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2},
},
@@ -537,6 +531,7 @@ func TestConsensus_ProcessProposal_With_Handler(t *testing.T) {
Height: 1,
Txs: [][]byte{mockTx.Bytes(), append(mockTx.Bytes(), []byte("bad")...), mockTx.Bytes(), mockTx.Bytes()},
})
require.NoError(t, err)
require.Equal(t, res.Status, abciproto.PROCESS_PROPOSAL_STATUS_REJECT)
}
@@ -642,9 +637,6 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock.
Block: &v1.BlockParams{
MaxGas: 300000,
},
Abci: &v1.ABCIParams{
VoteExtensionsEnableHeight: 2,
},
Feature: &v1.FeatureParams{
VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 2},
},
-3
View File
@@ -89,7 +89,6 @@ func (s *Server[T]) Start(ctx context.Context) error {
g, ctx := errgroup.WithContext(ctx)
for _, mod := range s.components {
mod := mod
g.Go(func() error {
return mod.Start(ctx)
})
@@ -110,7 +109,6 @@ func (s *Server[T]) Stop(ctx context.Context) error {
g, ctx := errgroup.WithContext(ctx)
for _, mod := range s.components {
mod := mod
g.Go(func() error {
return mod.Stop(ctx)
})
@@ -198,7 +196,6 @@ func (s *Server[T]) Init(appI AppI[T], cfg map[string]any, logger log.Logger) er
var components []ServerComponent[T]
for _, mod := range s.components {
mod := mod
if err := mod.Init(appI, cfg, logger); err != nil {
return err
}