Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbazn committed Dec 6, 2023
1 parent 582235b commit a35102a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ accounts:
# PhiLabs
- address: archway1ktka5q3cnsy3ar7qwj2huzz6qj9q4ys7h74l9y
chainName: archway
denom: aarch
denom: aarch
3 changes: 3 additions & 0 deletions pkg/collector/collector.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package collector

import (
"context"
"regexp"
"strings"

Expand All @@ -12,6 +13,8 @@ const (
errorStatus = "error"
)

var ctx = context.Background()

func getDiscordIDs(ops []config.Operator) string {
var ids []string

Expand Down
3 changes: 1 addition & 2 deletions pkg/collector/ibc_collector.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package collector

import (
"context"
"fmt"
"reflect"
"sync"
Expand Down Expand Up @@ -67,7 +66,7 @@ func (cc IBCCollector) Collect(ch chan<- prometheus.Metric) {
fmt.Sprintf("%s, %s", clientExpiryMetricName, channelStuckPacketsMetricName),
),
)
ctx := context.Background()

var wg sync.WaitGroup

for _, p := range cc.Paths {
Expand Down
13 changes: 5 additions & 8 deletions pkg/collector/wallet_balance_collector.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package collector

import (
"context"
"math/big"
"sync"

Expand All @@ -16,12 +15,10 @@ const (
walletBalanceMetricName = "cosmos_wallet_balance"
)

var (
walletBalance = prometheus.NewDesc(
walletBalanceMetricName,
"Returns wallet balance for an address on a chain.",
[]string{"account", "chain_id", "denom", "status"}, nil,
)
var walletBalance = prometheus.NewDesc(
walletBalanceMetricName,
"Returns wallet balance for an address on a chain.",
[]string{"account", "chain_id", "denom", "status"}, nil,
)

type WalletBalanceCollector struct {
Expand All @@ -35,8 +32,8 @@ func (wb WalletBalanceCollector) Describe(ch chan<- *prometheus.Desc) {

func (wb WalletBalanceCollector) Collect(ch chan<- prometheus.Metric) {
log.Debug("Start collecting", zap.String("metric", walletBalanceMetricName))

var wg sync.WaitGroup
ctx := context.Background()

for _, a := range wb.Accounts {
wg.Add(1)
Expand Down
16 changes: 10 additions & 6 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import (

const ibcPathSuffix = ".json"

var ErrGitHubClient = errors.New("GitHub client not provided")
var ErrMissingRPCConfigMsg = "missing RPC config for chain: %s"
var (
ErrGitHubClient = errors.New("GitHub client not provided")
ErrMissingRPCConfigMsg = "missing RPC config for chain: %s"
)

type Account struct {
Address string `yaml:"address" validate:"required"`
Expand Down Expand Up @@ -229,10 +231,10 @@ func (c *Config) Validate() error {
// register custom validation for http url as expected by go relayer i.e.
// http_url must have port defined.
// https://github.com/cosmos/relayer/blob/259b1278264180a2aefc2085f1b55753849c4815/cregistry/chain_info.go#L115
validate.RegisterValidation("has_port", func(fl validator.FieldLevel) bool {
err := validate.RegisterValidation("has_port", func(fl validator.FieldLevel) bool {
val := fl.Field().String()
val_arr := strings.Split(val, ":")
port := val_arr[len(val_arr)-1]
valArr := strings.Split(val, ":")
port := valArr[len(valArr)-1]

// Port must be a iny <= 65535.
if portNum, err := strconv.ParseInt(
Expand All @@ -242,11 +244,13 @@ func (c *Config) Validate() error {
}
return true
})
if err != nil {
return err
}

// validate top level fields
if err := validate.Struct(c); err != nil {
return err

}

// validate RPCs
Expand Down

0 comments on commit a35102a

Please sign in to comment.