Skip to content

Commit

Permalink
*: bump linter to 1.63.4 (#3444)
Browse files Browse the repository at this point in the history
Bump linter version...

category: misc
ticket: none
  • Loading branch information
KaloyanTanev authored Jan 8, 2025
1 parent 635e1ed commit e9c97c2
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2
version: v1.63.4
- name: notify failure
if: failure() && github.ref == 'refs/heads/main'
env:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit/run_linter.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION="1.62.2"
VERSION="1.63.4"

if ! command -v golangci-lint &> /dev/null
then
Expand Down
30 changes: 15 additions & 15 deletions cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"net/http"
"net/http/httptrace"
"os"
Expand All @@ -21,7 +22,6 @@ import (

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"golang.org/x/exp/maps"

"github.com/obolnetwork/charon/app/errors"
"github.com/obolnetwork/charon/app/log"
Expand Down Expand Up @@ -85,25 +85,25 @@ func listTestCases(cmd *cobra.Command) []string {
var testCaseNames []testCaseName
switch cmd.Name() {
case peersTestCategory:
testCaseNames = maps.Keys(supportedPeerTestCases())
testCaseNames = append(testCaseNames, maps.Keys(supportedSelfTestCases())...)
testCaseNames = slices.Collect(maps.Keys(supportedPeerTestCases()))
testCaseNames = append(testCaseNames, slices.Collect(maps.Keys(supportedSelfTestCases()))...)
case beaconTestCategory:
testCaseNames = maps.Keys(supportedBeaconTestCases())
testCaseNames = slices.Collect(maps.Keys(supportedBeaconTestCases()))
case validatorTestCategory:
testCaseNames = maps.Keys(supportedValidatorTestCases())
testCaseNames = slices.Collect(maps.Keys(supportedValidatorTestCases()))
case mevTestCategory:
testCaseNames = maps.Keys(supportedMEVTestCases())
testCaseNames = slices.Collect(maps.Keys(supportedMEVTestCases()))
case infraTestCategory:
testCaseNames = maps.Keys(supportedInfraTestCases())
testCaseNames = slices.Collect(maps.Keys(supportedInfraTestCases()))
case allTestCategory:
testCaseNames = slices.Concat(
maps.Keys(supportedPeerTestCases()),
maps.Keys(supportedSelfTestCases()),
maps.Keys(supportedRelayTestCases()),
maps.Keys(supportedBeaconTestCases()),
maps.Keys(supportedValidatorTestCases()),
maps.Keys(supportedMEVTestCases()),
maps.Keys(supportedInfraTestCases()),
slices.Collect(maps.Keys(supportedPeerTestCases())),
slices.Collect(maps.Keys(supportedSelfTestCases())),
slices.Collect(maps.Keys(supportedRelayTestCases())),
slices.Collect(maps.Keys(supportedBeaconTestCases())),
slices.Collect(maps.Keys(supportedValidatorTestCases())),
slices.Collect(maps.Keys(supportedMEVTestCases())),
slices.Collect(maps.Keys(supportedInfraTestCases())),
)
default:
log.Warn(cmd.Context(), "Unknown command for listing test cases", nil, z.Str("name", cmd.Name()))
Expand Down Expand Up @@ -315,7 +315,7 @@ func writeResultToWriter(res testCategoryResult, w io.Writer) error {
lines = append(lines, "")
lines = append(lines, fmt.Sprintf("%-64s%s", "TEST NAME", "RESULT"))
suggestions := []string{}
targets := maps.Keys(res.Targets)
targets := slices.Collect(maps.Keys(res.Targets))
slices.Sort(targets)
for _, target := range targets {
if target != "" && len(res.Targets[target]) > 0 {
Expand Down
5 changes: 3 additions & 2 deletions cmd/testbeacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"math"
"math/rand"
"net/http"
"os"
"path/filepath"
"slices"
"sort"
"strconv"
"strings"
Expand All @@ -20,7 +22,6 @@ import (

eth2v1 "github.com/attestantio/go-eth2-client/api/v1"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
"golang.org/x/sync/errgroup"

"github.com/obolnetwork/charon/app/errors"
Expand Down Expand Up @@ -210,7 +211,7 @@ func runTestBeacon(ctx context.Context, w io.Writer, cfg testBeaconConfig) (res
log.Info(ctx, "Starting beacon node test")

testCases := supportedBeaconTestCases()
queuedTests := filterTests(maps.Keys(testCases), cfg.testConfig)
queuedTests := filterTests(slices.Collect(maps.Keys(testCases)), cfg.testConfig)
if len(queuedTests) == 0 {
return res, errors.New("test case not supported")
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/testinfra.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"os"
"os/exec"
"runtime"
Expand All @@ -19,7 +20,6 @@ import (

"github.com/showwin/speedtest-go/speedtest"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"

"github.com/obolnetwork/charon/app/errors"
"github.com/obolnetwork/charon/app/log"
Expand Down Expand Up @@ -123,7 +123,7 @@ func runTestInfra(ctx context.Context, w io.Writer, cfg testInfraConfig) (res te
log.Info(ctx, "Starting hardware performance and network connectivity test")

testCases := supportedInfraTestCases()
queuedTests := filterTests(maps.Keys(testCases), cfg.testConfig)
queuedTests := filterTests(slices.Collect(maps.Keys(testCases)), cfg.testConfig)
if len(queuedTests) == 0 {
return res, errors.New("test case not supported")
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/testmev.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"net/http"
"net/http/httptrace"
"slices"
"strconv"
"strings"
"time"
Expand All @@ -20,7 +22,6 @@ import (
eth2a "github.com/attestantio/go-eth2-client/spec/altair"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
"golang.org/x/sync/errgroup"

"github.com/obolnetwork/charon/app/errors"
Expand Down Expand Up @@ -105,7 +106,7 @@ func runTestMEV(ctx context.Context, w io.Writer, cfg testMEVConfig) (res testCa
log.Info(ctx, "Starting MEV relays test")

testCases := supportedMEVTestCases()
queuedTests := filterTests(maps.Keys(testCases), cfg.testConfig)
queuedTests := filterTests(slices.Collect(maps.Keys(testCases)), cfg.testConfig)
if len(queuedTests) == 0 {
return res, errors.New("test case not supported")
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/testpeers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"math"
"math/rand"
"net"
Expand All @@ -25,7 +26,6 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
"github.com/spf13/cobra"
"golang.org/x/exp/maps"
"golang.org/x/sync/errgroup"

"github.com/obolnetwork/charon/app/errors"
Expand Down Expand Up @@ -151,15 +151,15 @@ func runTestPeers(ctx context.Context, w io.Writer, conf testPeersConfig) (res t
log.Info(ctx, "Starting charon peers and relays test")

relayTestCases := supportedRelayTestCases()
queuedTestsRelay := filterTests(maps.Keys(relayTestCases), conf.testConfig)
queuedTestsRelay := filterTests(slices.Collect(maps.Keys(relayTestCases)), conf.testConfig)
sortTests(queuedTestsRelay)

peerTestCases := supportedPeerTestCases()
queuedTestsPeer := filterTests(maps.Keys(peerTestCases), conf.testConfig)
queuedTestsPeer := filterTests(slices.Collect(maps.Keys(peerTestCases)), conf.testConfig)
sortTests(queuedTestsPeer)

selfTestCases := supportedSelfTestCases()
queuedTestsSelf := filterTests(maps.Keys(selfTestCases), conf.testConfig)
queuedTestsSelf := filterTests(slices.Collect(maps.Keys(selfTestCases)), conf.testConfig)
sortTests(queuedTestsSelf)

if len(queuedTestsPeer) == 0 && len(queuedTestsSelf) == 0 {
Expand Down
6 changes: 3 additions & 3 deletions cmd/testpeers_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io"
"maps"
"net/http"
"os"
"slices"
Expand All @@ -19,7 +20,6 @@ import (
k1 "github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"

"github.com/obolnetwork/charon/app/k1util"
"github.com/obolnetwork/charon/app/log"
Expand Down Expand Up @@ -352,8 +352,8 @@ func testWriteOut(t *testing.T, expectedRes testCategoryResult, buf bytes.Buffer
bufTests = slices.Delete(bufTests, 0, 8)
bufTests = slices.Delete(bufTests, len(bufTests)-4, len(bufTests))

nTargets := len(maps.Keys(expectedRes.Targets))
require.Len(t, bufTests, len(slices.Concat(maps.Values(expectedRes.Targets)...))+nTargets*2)
nTargets := len(slices.Collect(maps.Keys(expectedRes.Targets)))
require.Len(t, bufTests, len(slices.Concat(slices.Collect(maps.Values(expectedRes.Targets))...))+nTargets*2)

for range nTargets {
bufTests = bufTests[1:]
Expand Down
5 changes: 3 additions & 2 deletions cmd/testvalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ package cmd
import (
"context"
"io"
"maps"
"math"
"math/rand"
"net"
"slices"
"sync"
"time"

"github.com/spf13/cobra"
"golang.org/x/exp/maps"

"github.com/obolnetwork/charon/app/errors"
"github.com/obolnetwork/charon/app/log"
Expand Down Expand Up @@ -72,7 +73,7 @@ func runTestValidator(ctx context.Context, w io.Writer, cfg testValidatorConfig)
log.Info(ctx, "Starting validator client test")

testCases := supportedValidatorTestCases()
queuedTests := filterTests(maps.Keys(testCases), cfg.testConfig)
queuedTests := filterTests(slices.Collect(maps.Keys(testCases)), cfg.testConfig)
if len(queuedTests) == 0 {
err = errors.New("test case not supported")
return res, err
Expand Down
2 changes: 1 addition & 1 deletion core/validatorapi/validatorapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package validatorapi_test
import (
"context"
"fmt"
"maps"
"sort"
"strconv"
"sync"
Expand All @@ -24,7 +25,6 @@ import (
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/prysmaticlabs/go-bitfield"
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"

"github.com/obolnetwork/charon/app/errors"
"github.com/obolnetwork/charon/app/eth2wrap"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ require (
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.32.0
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
golang.org/x/sync v0.10.0
golang.org/x/term v0.28.0
golang.org/x/time v0.8.0
Expand Down Expand Up @@ -209,6 +208,7 @@ require (
go.uber.org/fx v1.23.0 // indirect
go.uber.org/mock v0.5.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sys v0.29.0 // indirect
Expand Down
5 changes: 2 additions & 3 deletions testutil/compose/fuzz/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ func TestFuzzers(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
dir, err := os.MkdirTemp("", "")
require.NoError(t, err)
dir := t.TempDir()

config := test.configFunc(defaultConfig)
require.NoError(t, compose.WriteConfig(dir, config))
Expand All @@ -79,7 +78,7 @@ func TestFuzzers(t *testing.T) {
autoConfig.LogFile = path.Join(*logDir, test.name+".log")
}

err = compose.Auto(context.Background(), autoConfig)
err := compose.Auto(context.Background(), autoConfig)
testutil.RequireNoError(t, err)
})
}
Expand Down
2 changes: 1 addition & 1 deletion testutil/integration/simnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ func startTeku(t *testing.T, args simnetArgs, node int) simnetArgs {
// Support specifying a custom base directory for docker mounts (required if running colima on macOS).
if dir, ok := os.LookupEnv("TEST_DOCKER_DIR"); ok {
var err error
tempDir, err = os.MkdirTemp(dir, "")
tempDir, err = os.MkdirTemp(dir, "") //nolint: usetesting // support custom base directory
require.NoError(t, err)
}

Expand Down

0 comments on commit e9c97c2

Please sign in to comment.