Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbazn committed Dec 7, 2023
1 parent a35102a commit fa1bc15
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"net/url"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -142,7 +143,7 @@ func (c *Config) GetRPCsMap(ibcPaths []*IBCData) (*map[string]RPC, error) {
for _, ibcPath := range ibcPaths {
// Check RPC for chain 1
if _, ok := rpcs[ibcPath.Chain1.ChainName]; !ok {
return &rpcs, fmt.Errorf("missing RPC config for chain: %s", ibcPath.Chain1.ChainName)
return &rpcs, fmt.Errorf(ErrMissingRPCConfigMsg, ibcPath.Chain1.ChainName)
}

// Check RPC for chain 2
Expand Down Expand Up @@ -233,8 +234,12 @@ func (c *Config) Validate() error {
// https://github.com/cosmos/relayer/blob/259b1278264180a2aefc2085f1b55753849c4815/cregistry/chain_info.go#L115
err := validate.RegisterValidation("has_port", func(fl validator.FieldLevel) bool {
val := fl.Field().String()
valArr := strings.Split(val, ":")
port := valArr[len(valArr)-1]
urlParsed, err := url.Parse(val)
if err != nil {
return false
}

port := urlParsed.Port()

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

Check failure on line 252 in pkg/config/config.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint

[GolangCI Lint] pkg/config/config.go#L252

File is not `gofumpt`-ed with `-extra` (gofumpt)
Raw output
pkg/config/config.go:252: File is not `gofumpt`-ed with `-extra` (gofumpt)
if err != nil {
return err
}
Expand Down

0 comments on commit fa1bc15

Please sign in to comment.