Skip to content

Commit

Permalink
formatting: format code and imports with gci
Browse files Browse the repository at this point in the history
  • Loading branch information
iurii-ssv committed Feb 24, 2025
1 parent 83e58c0 commit b6ad35b
Show file tree
Hide file tree
Showing 219 changed files with 448 additions and 262 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,4 @@ mockgen-install:

.PHONY: format
format:
# both format commands must ignore generated files which are named *mock* or enr_fork_id_encoding.go
# the argument to gopls format can be a list of files
find . -name "*.go" ! -path '*mock*' ! -name 'enr_fork_id_encoding.go' -type f -print0 | xargs -0 -P 1 sh -c 'gopls -v format -w $0'
# the argument to gopls imports must be a single file so this entire command takes a few mintues to run
find . -name "*.go" ! -path '*mock*' ! -name 'enr_fork_id_encoding.go' -type f -print0 | xargs -0 -P 10 -I{} sh -c 'gopls -v imports -w "{}"'
gci write -s standard -s default -s blank -s dot -s localmodule -s "prefix(github.com/ssvlabs/ssv-spec)" $$(find . -type f -name '*.go' -not -path "*mock*" -not -name "*.gen.go")
5 changes: 3 additions & 2 deletions api/handlers/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"net/http"

"github.com/attestantio/go-eth2-client/spec/phase0"

spectypes "github.com/ssvlabs/ssv-spec/types"
"github.com/ssvlabs/ssv/networkconfig"
qbftstorage "github.com/ssvlabs/ssv/protocol/v2/qbft/storage"

"github.com/ssvlabs/ssv/api"
ibftstorage "github.com/ssvlabs/ssv/ibft/storage"
"github.com/ssvlabs/ssv/networkconfig"
qbftstorage "github.com/ssvlabs/ssv/protocol/v2/qbft/storage"
)

type Exporter struct {
Expand Down
2 changes: 2 additions & 0 deletions api/handlers/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (
"strings"

"github.com/attestantio/go-eth2-client/spec/phase0"

spectypes "github.com/ssvlabs/ssv-spec/types"

"github.com/ssvlabs/ssv/api"
"github.com/ssvlabs/ssv/protocol/v2/types"
registrystorage "github.com/ssvlabs/ssv/registry/storage"
Expand Down
1 change: 1 addition & 0 deletions api/handlers/validators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

spectypes "github.com/ssvlabs/ssv-spec/types"

"github.com/ssvlabs/ssv/protocol/v2/types"
)

Expand Down
3 changes: 2 additions & 1 deletion beacon/goclient/attest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/sourcegraph/conc/pool"
"github.com/ssvlabs/ssv-spec/types"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/ssvlabs/ssv-spec/types"

operatordatastore "github.com/ssvlabs/ssv/operator/datastore"
"github.com/ssvlabs/ssv/operator/slotticker"
"github.com/ssvlabs/ssv/protocol/v2/blockchain/beacon"
Expand Down
5 changes: 3 additions & 2 deletions beacon/goclient/goclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ import (
"github.com/jellydator/ttlcache/v3"
"github.com/pkg/errors"
"github.com/rs/zerolog"
specssv "github.com/ssvlabs/ssv-spec/ssv"
spectypes "github.com/ssvlabs/ssv-spec/types"
"go.uber.org/zap"
"tailscale.com/util/singleflight"

specssv "github.com/ssvlabs/ssv-spec/ssv"
spectypes "github.com/ssvlabs/ssv-spec/types"

"github.com/ssvlabs/ssv/logging/fields"
operatordatastore "github.com/ssvlabs/ssv/operator/datastore"
"github.com/ssvlabs/ssv/operator/slotticker"
Expand Down
3 changes: 2 additions & 1 deletion beacon/goclient/goclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"github.com/attestantio/go-eth2-client/api"
v1 "github.com/attestantio/go-eth2-client/api/v1"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/ssvlabs/ssv-spec/types"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/ssvlabs/ssv-spec/types"

operatordatastore "github.com/ssvlabs/ssv/operator/datastore"
"github.com/ssvlabs/ssv/operator/slotticker"
"github.com/ssvlabs/ssv/protocol/v2/blockchain/beacon"
Expand Down
1 change: 0 additions & 1 deletion beacon/goclient/observability.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/attestantio/go-eth2-client/api"
"github.com/attestantio/go-eth2-client/spec/phase0"

"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
Expand Down
3 changes: 2 additions & 1 deletion beacon/goclient/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"github.com/attestantio/go-eth2-client/spec/phase0"
ssz "github.com/ferranbt/fastssz"
"github.com/sourcegraph/conc/pool"
spectypes "github.com/ssvlabs/ssv-spec/types"
"go.uber.org/zap"

spectypes "github.com/ssvlabs/ssv-spec/types"

"github.com/ssvlabs/ssv/logging/fields"
"github.com/ssvlabs/ssv/operator/slotticker"
)
Expand Down
3 changes: 2 additions & 1 deletion beacon/goclient/signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
"github.com/attestantio/go-eth2-client/spec/phase0"
ssz "github.com/ferranbt/fastssz"
"github.com/pkg/errors"
spectypes "github.com/ssvlabs/ssv-spec/types"
"go.uber.org/zap"

spectypes "github.com/ssvlabs/ssv-spec/types"
)

func (gc *GoClient) computeVoluntaryExitDomain(ctx context.Context) (phase0.Domain, error) {
Expand Down
3 changes: 1 addition & 2 deletions beacon/goclient/sync_committee.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import (

"github.com/attestantio/go-eth2-client/api"
eth2apiv1 "github.com/attestantio/go-eth2-client/api/v1"
"go.uber.org/zap"

"github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/altair"
"github.com/attestantio/go-eth2-client/spec/phase0"
"go.uber.org/zap"
)

// SyncCommitteeDuties returns sync committee duties for a given epoch
Expand Down
3 changes: 2 additions & 1 deletion beacon/goclient/sync_committee_contribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
"github.com/attestantio/go-eth2-client/spec/altair"
"github.com/attestantio/go-eth2-client/spec/phase0"
ssz "github.com/ferranbt/fastssz"
spectypes "github.com/ssvlabs/ssv-spec/types"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"

spectypes "github.com/ssvlabs/ssv-spec/types"
)

// IsSyncCommitteeAggregator returns tru if aggregator
Expand Down
8 changes: 3 additions & 5 deletions cli/bootnode/boot_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import (
"fmt"
"log"

"github.com/ssvlabs/ssv/networkconfig"
"github.com/ssvlabs/ssv/utils/commons"

"github.com/ssvlabs/ssv/logging"

"github.com/ilyakaznacheev/cleanenv"
"github.com/spf13/cobra"
"go.uber.org/zap"

global_config "github.com/ssvlabs/ssv/cli/config"
"github.com/ssvlabs/ssv/logging"
"github.com/ssvlabs/ssv/networkconfig"
bootnode "github.com/ssvlabs/ssv/utils/boot_node"
"github.com/ssvlabs/ssv/utils/commons"
)

type config struct {
Expand Down
3 changes: 1 addition & 2 deletions cli/generate_operator_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import (
"os"
"path/filepath"

"github.com/ssvlabs/ssv/operator/keystore"

"github.com/spf13/cobra"
"go.uber.org/zap"

"github.com/ssvlabs/ssv/logging"
"github.com/ssvlabs/ssv/operator/keys"
"github.com/ssvlabs/ssv/operator/keystore"
)

var generateOperatorKeysCmd = &cobra.Command{
Expand Down
3 changes: 2 additions & 1 deletion cli/operator/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import (
"github.com/ilyakaznacheev/cleanenv"
"github.com/pkg/errors"
"github.com/spf13/cobra"
spectypes "github.com/ssvlabs/ssv-spec/types"
"go.uber.org/zap"

spectypes "github.com/ssvlabs/ssv-spec/types"

"github.com/ssvlabs/ssv/api/handlers"
apiserver "github.com/ssvlabs/ssv/api/server"
"github.com/ssvlabs/ssv/beacon/goclient"
Expand Down
3 changes: 1 addition & 2 deletions cli/threshold.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import (
"github.com/spf13/cobra"
"go.uber.org/zap"

"github.com/ssvlabs/ssv/cli/flags"
"github.com/ssvlabs/ssv/logging"
ssvtypes "github.com/ssvlabs/ssv/protocol/v2/types"
"github.com/ssvlabs/ssv/utils/threshold"

"github.com/ssvlabs/ssv/cli/flags"
)

// createThreshold is the command to create threshold based on the given private key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"crypto/rand"
"fmt"
"sort"

v1 "github.com/attestantio/go-eth2-client/api/v1"
"github.com/attestantio/go-eth2-client/spec/phase0"
"go.uber.org/zap"
"sort"
)

type AttesterSlashingTest struct {
Expand Down
3 changes: 2 additions & 1 deletion e2e/beacon_proxy/intercept/slashinginterceptor/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"crypto/rand"
"encoding/json"
"fmt"
"sort"

v1 "github.com/attestantio/go-eth2-client/api/v1"
"github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/capella"
"github.com/attestantio/go-eth2-client/spec/phase0"
"go.uber.org/zap"
"sort"
)

type ProposerSlashingTest struct {
Expand Down
2 changes: 1 addition & 1 deletion e2e/beacon_proxy/intercept/slashinginterceptor/slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
v1 "github.com/attestantio/go-eth2-client/api/v1"
"github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/ssvlabs/ssv/protocol/v2/blockchain/beacon"
"go.uber.org/zap"
"golang.org/x/exp/maps"

beaconproxy "github.com/ssvlabs/ssv/e2e/beacon_proxy"
"github.com/ssvlabs/ssv/protocol/v2/blockchain/beacon"
)

const startEndEpochsDiff = 2
Expand Down
2 changes: 1 addition & 1 deletion e2e/cmd/ssv-e2e/beacon_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (
"github.com/attestantio/go-eth2-client/http"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/rs/zerolog"
"github.com/ssvlabs/ssv/networkconfig"
"go.uber.org/zap"
"golang.org/x/exp/maps"

beaconproxy "github.com/ssvlabs/ssv/e2e/beacon_proxy"
"github.com/ssvlabs/ssv/e2e/beacon_proxy/intercept/slashinginterceptor"
"github.com/ssvlabs/ssv/networkconfig"
)

type BeaconProxyCmd struct {
Expand Down
6 changes: 4 additions & 2 deletions e2e/cmd/ssv-e2e/share_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import (
"path/filepath"

"github.com/attestantio/go-eth2-client/spec/phase0"
"go.uber.org/zap"
"gopkg.in/yaml.v3"

"github.com/ssvlabs/ssv-spec/types"

"github.com/ssvlabs/ssv/e2e/logs_catcher"
"github.com/ssvlabs/ssv/ekm"
"github.com/ssvlabs/ssv/networkconfig"
Expand All @@ -18,8 +22,6 @@ import (
"github.com/ssvlabs/ssv/storage/kv"
"github.com/ssvlabs/ssv/utils/blskeygen"
"github.com/ssvlabs/ssv/utils/rsaencryption"
"go.uber.org/zap"
"gopkg.in/yaml.v3"
)

type ShareUpdateCmd struct {
Expand Down
6 changes: 4 additions & 2 deletions e2e/logs_catcher/docker/docker_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package docker
import (
"bufio"
"context"
"io"
"strings"

"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/pkg/errors"

"github.com/ssvlabs/ssv/e2e/logs_catcher/logs"
"io"
"strings"
)

type Streamer interface {
Expand Down
1 change: 1 addition & 0 deletions e2e/logs_catcher/docker/restarter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package docker

import (
"context"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
)
Expand Down
4 changes: 3 additions & 1 deletion e2e/logs_catcher/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package logs_catcher
import (
"context"
"fmt"

"github.com/pkg/errors"
"go.uber.org/zap"

"github.com/ssvlabs/ssv/e2e/logs_catcher/docker"
"github.com/ssvlabs/ssv/e2e/logs_catcher/parser"
"go.uber.org/zap"
)

const MesasgeKey = "msg" // todo: pass to struct/load from config
Expand Down
3 changes: 2 additions & 1 deletion e2e/logs_catcher/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package logs_catcher
import (
"context"
"encoding/binary"
"io"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"io"
)

type mockDockerClient struct {
Expand Down
3 changes: 1 addition & 2 deletions e2e/logs_catcher/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package logs_catcher

import (
"context"
"errors"
"fmt"
"time"

"errors"

"go.uber.org/zap"

"github.com/ssvlabs/ssv/e2e/logs_catcher/docker"
Expand Down
10 changes: 5 additions & 5 deletions e2e/logs_catcher/matcher_bls.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"strings"
"time"

"github.com/ssvlabs/ssv/e2e/logs_catcher/logs"
"github.com/ssvlabs/ssv/e2e/logs_catcher/parser"

"github.com/attestantio/go-eth2-client/spec/phase0"
"go.uber.org/zap"

"github.com/ssvlabs/ssv-spec/qbft"
"github.com/ssvlabs/ssv-spec/types"
"github.com/ssvlabs/ssv/protocol/v2/message"
"go.uber.org/zap"

"github.com/ssvlabs/ssv/e2e/logs_catcher/docker"
"github.com/ssvlabs/ssv/e2e/logs_catcher/logs"
"github.com/ssvlabs/ssv/e2e/logs_catcher/parser"
"github.com/ssvlabs/ssv/protocol/v2/message"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions ekm/signer_key_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ import (
"github.com/prysmaticlabs/go-bitfield"
"github.com/ssvlabs/eth2-key-manager/core"
"github.com/ssvlabs/eth2-key-manager/wallets/hd"
spectypes "github.com/ssvlabs/ssv-spec/types"
"github.com/ssvlabs/ssv-spec/types/testingutils"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

spectypes "github.com/ssvlabs/ssv-spec/types"
"github.com/ssvlabs/ssv-spec/types/testingutils"

"github.com/ssvlabs/ssv/logging"
"github.com/ssvlabs/ssv/networkconfig"
"github.com/ssvlabs/ssv/operator/keys"
Expand Down
3 changes: 1 addition & 2 deletions ekm/signer_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import (

"github.com/ssvlabs/ssv/logging"
"github.com/ssvlabs/ssv/networkconfig"
"github.com/ssvlabs/ssv/storage/kv"

"github.com/ssvlabs/ssv/storage/basedb"
"github.com/ssvlabs/ssv/storage/kv"
"github.com/ssvlabs/ssv/utils/threshold"
)

Expand Down
Loading

0 comments on commit b6ad35b

Please sign in to comment.