Skip to content

Commit

Permalink
chore: more golangci-lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jan 3, 2022
1 parent 6087b61 commit c1a9d25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ func Execute(cmd *cobra.Command, args []string) {
grpc.WithInsecure(),
)
if err != nil {
panic(err)
log.Fatal().Err(err).Msg("Could not connect to gRPC node")
}

defer grpcConn.Close()

setChainId()
setChainID()
setDenom(grpcConn)

http.HandleFunc("/metrics/wallet", func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -184,7 +182,7 @@ func Execute(cmd *cobra.Command, args []string) {
}
}

func setChainId() {
func setChainID() {
client, err := tmrpc.New(TendermintRpc, "/websocket")
if err != nil {
log.Fatal().Err(err).Msg("Could not create Tendermint client")
Expand Down
4 changes: 2 additions & 2 deletions validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func ValidatorHandler(w http.ResponseWriter, r *http.Request, grpcConn *grpc.Cli
validatorJailedGauge.With(prometheus.Labels{
"address": validator.Validator.OperatorAddress,
"moniker": validator.Validator.Description.Moniker,
}).Set(float64(jailed))
}).Set(jailed)

var wg sync.WaitGroup

Expand Down Expand Up @@ -576,7 +576,7 @@ func ValidatorHandler(w http.ResponseWriter, r *http.Request, grpcConn *grpc.Cli
validators := stakingRes.Validators

// sorting by delegator shares to display rankings
sort.Slice(validators[:], func(i, j int) bool {
sort.Slice(validators, func(i, j int) bool {
firstShares, firstErr := strconv.ParseFloat(validators[i].DelegatorShares.String(), 64)
secondShares, secondErr := strconv.ParseFloat(validators[j].DelegatorShares.String(), 64)

Expand Down
4 changes: 2 additions & 2 deletions validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func ValidatorsHandler(w http.ResponseWriter, r *http.Request, grpcConn *grpc.Cl
validators = validatorsResponse.Validators

// sorting by delegator shares to display rankings
sort.Slice(validators[:], func(i, j int) bool {
sort.Slice(validators, func(i, j int) bool {
return validators[i].DelegatorShares.RoundInt64() > validators[j].DelegatorShares.RoundInt64()
})
}()
Expand Down Expand Up @@ -247,7 +247,7 @@ func ValidatorsHandler(w http.ResponseWriter, r *http.Request, grpcConn *grpc.Cl
validatorsJailedGauge.With(prometheus.Labels{
"address": validator.OperatorAddress,
"moniker": validator.Description.Moniker,
}).Set(float64(jailed))
}).Set(jailed)

validatorsTokensGauge.With(prometheus.Labels{
"address": validator.OperatorAddress,
Expand Down

0 comments on commit c1a9d25

Please sign in to comment.