Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov committed Aug 27, 2024
1 parent 43e133f commit 1b59e1d
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 24 deletions.
4 changes: 3 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ linters:
- unused
# extra
- exhaustive
- exportloopref
- revive
- goimports
- gosec
Expand All @@ -27,6 +26,9 @@ linters-settings:
local-prefixes: github.com/smartcontractkit/chainlink-testing-framework
gosec:
exclude-generated: true
excludes:
# Potential integer overflow when converting between integer types, a lot of false positives
- G115
govet:
# report about shadowed variables
check-shadowing: false
Expand Down
3 changes: 0 additions & 3 deletions blockchain/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,6 @@ func (e *EthereumClient) WaitForEvents() error {
g := errgroup.Group{}

for subName, sub := range queuedEvents {
subName := subName
sub := sub
g.Go(func() error {
defer func() {
// if the subscription is complete, delete it from the queue
Expand Down Expand Up @@ -1729,7 +1727,6 @@ func (e *EthereumMultinodeClient) DeleteHeaderEventSubscription(key string) {
func (e *EthereumMultinodeClient) WaitForEvents() error {
g := errgroup.Group{}
for _, c := range e.Clients {
c := c
g.Go(func() error {
return c.WaitForEvents()
})
Expand Down
1 change: 0 additions & 1 deletion blockchain/transaction_confirmers.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ func (e *EthereumClient) receiveHeader(header *SafeEVMHeader) error {

g := errgroup.Group{}
for _, sub := range subs {
sub := sub
g.Go(func() error {
return sub.ReceiveHeader(safeHeader)
})
Expand Down
16 changes: 8 additions & 8 deletions config/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,21 @@ func (n *NetworkConfig) OverrideURLsAndKeysFromEVMNetwork() {
return
}
for name, evmNetwork := range n.EVMNetworks {
if evmNetwork.URLs != nil && len(evmNetwork.URLs) > 0 {
if len(evmNetwork.URLs) > 0 {
logging.L.Warn().Str("network", name).Msg("found URLs in EVMNetwork. overriding RPC URLs in RpcWsUrls with EVMNetwork URLs")
if n.RpcWsUrls == nil {
n.RpcWsUrls = make(map[string][]string)
}
n.RpcWsUrls[name] = evmNetwork.URLs
}
if evmNetwork.HTTPURLs != nil && len(evmNetwork.HTTPURLs) > 0 {
if len(evmNetwork.HTTPURLs) > 0 {
logging.L.Warn().Str("network", name).Msg("found HTTPURLs in EVMNetwork. overriding RPC URLs in RpcHttpUrls with EVMNetwork HTTP URLs")
if n.RpcHttpUrls == nil {
n.RpcHttpUrls = make(map[string][]string)
}
n.RpcHttpUrls[name] = evmNetwork.HTTPURLs
}
if evmNetwork.PrivateKeys != nil && len(evmNetwork.PrivateKeys) > 0 {
if len(evmNetwork.PrivateKeys) > 0 {
logging.L.Warn().Str("network", name).Msg("found PrivateKeys in EVMNetwork. overriding wallet keys in WalletKeys with EVMNetwork private keys")
if n.WalletKeys == nil {
n.WalletKeys = make(map[string][]string)
Expand Down Expand Up @@ -261,7 +261,7 @@ func (n *NetworkConfig) applyDefaults(defaults *NetworkConfig) error {
n.SelectedNetworks = defaults.SelectedNetworks
}
if defaults.EVMNetworks != nil {
if n.EVMNetworks == nil || len(n.EVMNetworks) == 0 {
if len(n.EVMNetworks) == 0 {
n.EVMNetworks = defaults.EVMNetworks
} else {
for network, cfg := range defaults.EVMNetworks {
Expand All @@ -272,7 +272,7 @@ func (n *NetworkConfig) applyDefaults(defaults *NetworkConfig) error {
}
}
if defaults.AnvilConfigs != nil {
if n.AnvilConfigs == nil || len(n.AnvilConfigs) == 0 {
if len(n.AnvilConfigs) == 0 {
n.AnvilConfigs = defaults.AnvilConfigs
} else {
for network, cfg := range defaults.AnvilConfigs {
Expand All @@ -283,7 +283,7 @@ func (n *NetworkConfig) applyDefaults(defaults *NetworkConfig) error {
}
}
if defaults.RpcHttpUrls != nil {
if n.RpcHttpUrls == nil || len(n.RpcHttpUrls) == 0 {
if len(n.RpcHttpUrls) == 0 {
n.RpcHttpUrls = defaults.RpcHttpUrls
} else {
for network, urls := range defaults.RpcHttpUrls {
Expand All @@ -294,7 +294,7 @@ func (n *NetworkConfig) applyDefaults(defaults *NetworkConfig) error {
}
}
if defaults.RpcWsUrls != nil {
if n.RpcWsUrls == nil || len(n.RpcWsUrls) == 0 {
if len(n.RpcWsUrls) == 0 {
n.RpcWsUrls = defaults.RpcWsUrls
} else {
for network, urls := range defaults.RpcWsUrls {
Expand All @@ -305,7 +305,7 @@ func (n *NetworkConfig) applyDefaults(defaults *NetworkConfig) error {
}
}
if defaults.WalletKeys != nil {
if n.WalletKeys == nil || len(n.WalletKeys) == 0 {
if len(n.WalletKeys) == 0 {
n.WalletKeys = defaults.WalletKeys
} else {

Expand Down
2 changes: 0 additions & 2 deletions docker/test_env/killgrave_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ func runTestWithExpectations(t *testing.T, k *Killgrave, expectations []kgTest)
var err error
// Check the different kinds of responses
for _, test := range expectations {
test := test

t.Run(test.Name, func(t *testing.T) {
t.Parallel()
m := []string{http.MethodGet}
Expand Down
1 change: 0 additions & 1 deletion logstream/logstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ func TestLogStreamDocker(t *testing.T) {
}

for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
ctx := testcontext.Get(t)
Expand Down
1 change: 0 additions & 1 deletion networks/known_networks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ new_network = ["ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
},
}
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
encoded := base64.StdEncoding.EncodeToString([]byte(tc.networkConfigTOML))
err := os.Setenv("BASE64_NETWORK_CONFIG", encoded)
Expand Down
1 change: 0 additions & 1 deletion seth/block_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (cs *BlockStats) Stats(startBlock *big.Int, endBlock *big.Int) error {
blockMu := &sync.Mutex{}
eg := &errgroup.Group{}
for bn := startBlock.Int64(); bn < endBlock.Int64(); bn++ {
bn := bn
eg.Go(func() error {
cs.Limiter.Take()
block, err := cs.Client.Client.BlockByNumber(context.Background(), big.NewInt(bn))
Expand Down
1 change: 0 additions & 1 deletion seth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ func NewClientRaw(
eg, egCtx := errgroup.WithContext(ctx)
// root key is element 0 in ephemeral
for _, addr := range c.Addresses[1:] {
addr := addr
eg.Go(func() error {
return c.TransferETHFromKey(egCtx, 0, addr.Hex(), bd.AddrFunding, gasPrice)
})
Expand Down
1 change: 0 additions & 1 deletion seth/client_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ func TestAPIKeys(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
wg := &sync.WaitGroup{}
for i := 1; i < 61; i++ {
i := i
wg.Add(1)
go func() {
defer wg.Done()
Expand Down
1 change: 0 additions & 1 deletion seth/test_utils/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func NewClientWithAddresses(t *testing.T, addressCount int, funding *big.Int) *s
eg, egCtx := errgroup.WithContext(ctx)
// root key is element 0 in ephemeral
for _, addr := range addresses {
addr := addr
eg.Go(func() error {
return c.TransferETHFromKey(egCtx, 0, addr, funding, gasPrice)
})
Expand Down
4 changes: 2 additions & 2 deletions utils/seth/seth.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ func ValidateSethNetworkConfig(cfg *pkg_seth.Network) error {
if cfg == nil {
return errors.New("network cannot be nil")
}
if cfg.URLs == nil || len(cfg.URLs) == 0 {
if len(cfg.URLs) == 0 {
return errors.New("URLs are required")
}
if cfg.PrivateKeys == nil || len(cfg.PrivateKeys) == 0 {
if len(cfg.PrivateKeys) == 0 {
return errors.New("PrivateKeys are required")
}
if cfg.TransferGasFee == 0 {
Expand Down
2 changes: 1 addition & 1 deletion wasp/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (m *Profile) printDashboardLink() {
if err != nil {
log.Warn().Msgf("could not get dashboard link: %s", err)
} else {
log.Info().Msgf("Dashboard URL: " + url)
log.Info().Msgf("Dashboard URL: %s", url)
}
}

Expand Down

0 comments on commit 1b59e1d

Please sign in to comment.