From 7c7bd7ae57e4b2d28f82e7bd6314d2bb97cff531 Mon Sep 17 00:00:00 2001 From: Techno Freak Date: Sat, 10 Feb 2024 00:16:31 +0300 Subject: [PATCH] chore: fixed linting --- pkg/config/config.go | 3 ++- pkg/fetcher/cosmos.go | 3 ++- pkg/fetcher/noop.go | 4 ++-- pkg/tendermint/tendermint.go | 3 ++- pkg/types/converter.go | 6 +++--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 6a2a601..314416b 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,6 +1,7 @@ package config import ( + "errors" "fmt" "slices" "time" @@ -37,7 +38,7 @@ func (c Config) Validate() error { } if c.IsConsumer() && c.ConsumerChainID == "" { - return fmt.Errorf("chain is consumer, but consumer-chain-id is not set") + return errors.New("chain is consumer, but consumer-chain-id is not set") } return nil diff --git a/pkg/fetcher/cosmos.go b/pkg/fetcher/cosmos.go index 1f32c87..2d2e4b6 100644 --- a/pkg/fetcher/cosmos.go +++ b/pkg/fetcher/cosmos.go @@ -2,6 +2,7 @@ package fetcher import ( "encoding/json" + "errors" "fmt" configPkg "main/pkg/config" "main/pkg/types" @@ -185,7 +186,7 @@ func (f *CosmosDataFetcher) GetUpgradePlan() (*types.Upgrade, error) { } if response.Plan == nil { - return nil, fmt.Errorf("upgrade plan is not present") + return nil, errors.New("upgrade plan is not present") } return &types.Upgrade{ diff --git a/pkg/fetcher/noop.go b/pkg/fetcher/noop.go index d163cbc..09a6285 100644 --- a/pkg/fetcher/noop.go +++ b/pkg/fetcher/noop.go @@ -1,7 +1,7 @@ package fetcher import ( - "fmt" + "errors" "main/pkg/types" ) @@ -17,5 +17,5 @@ func (f *NoopDataFetcher) GetValidators() (*types.ChainValidators, error) { } func (f *NoopDataFetcher) GetUpgradePlan() (*types.Upgrade, error) { - return nil, fmt.Errorf("upgrade is not present") + return nil, errors.New("upgrade is not present") } diff --git a/pkg/tendermint/tendermint.go b/pkg/tendermint/tendermint.go index 06504d8..58daf45 100644 --- a/pkg/tendermint/tendermint.go +++ b/pkg/tendermint/tendermint.go @@ -2,6 +2,7 @@ package tendermint import ( "encoding/json" + "errors" "fmt" configPkg "main/pkg/config" "net/http" @@ -47,7 +48,7 @@ func (rpc *RPC) GetValidators() ([]types.TendermintValidator, error) { } if response == nil || response.Result == nil || response.Result.Total == "" { - return nil, fmt.Errorf("malformed response from node") + return nil, errors.New("malformed response from node") } total, err := strconv.ParseInt(response.Result.Total, 10, 64) diff --git a/pkg/types/converter.go b/pkg/types/converter.go index ea79dbd..2d4d22c 100644 --- a/pkg/types/converter.go +++ b/pkg/types/converter.go @@ -1,7 +1,7 @@ package types import ( - "fmt" + "errors" "math/big" "strings" ) @@ -21,7 +21,7 @@ func ValidatorsWithLatestRoundFromTendermintResponse( vp := new(big.Int) vp, ok := vp.SetString(validator.VotingPower, 10) if !ok { - return nil, fmt.Errorf("error setting string") + return nil, errors.New("error setting string") } validators[index] = ValidatorWithRoundVote{ @@ -62,7 +62,7 @@ func ValidatorsWithAllRoundsFromTendermintResponse( vp := new(big.Int) vp, ok := vp.SetString(validator.VotingPower, 10) if !ok { - return ValidatorsWithAllRoundsVotes{}, fmt.Errorf("error setting string") + return ValidatorsWithAllRoundsVotes{}, errors.New("error setting string") } validators[index] = Validator{