From 6e3b78b99e517bfcadc13a1233ccfc155b81add0 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Sun, 31 May 2020 13:08:36 -0700 Subject: [PATCH] Ran code cleanup from goland (#6064) * Ran code cleanup from goland * Typo --- beacon-chain/blockchain/init_sync_process_block_test.go | 2 +- beacon-chain/blockchain/service_test.go | 2 +- beacon-chain/main.go | 4 ++-- beacon-chain/p2p/encoder/ssz.go | 2 +- beacon-chain/p2p/service_test.go | 4 ++-- beacon-chain/p2p/testing/p2p.go | 2 +- beacon-chain/rpc/beacon/validators_stream.go | 2 +- .../subscriber_committee_index_beacon_attestation_test.go | 6 +++--- shared/bls/spectest/aggregate_test.go | 2 +- shared/bls/spectest/aggregate_verify_test.go | 2 +- shared/bls/spectest/fast_aggregate_verify_test.go | 2 +- shared/bls/spectest/sign_test.go | 2 +- shared/bls/spectest/verify_test.go | 2 +- slasher/db/kv/proposer_slashings_test.go | 2 +- slasher/detection/attestations/spanner.go | 2 +- slasher/main.go | 2 +- tools/bootnode-query/main.go | 2 +- tools/bootnode/bootnode.go | 2 +- tools/deployContract/deployContract.go | 4 ++-- tools/drainContracts/drainContracts.go | 2 +- tools/faucet/main.go | 2 +- tools/faucet/server.go | 2 +- tools/interop/convert-keys/main.go | 2 +- tools/pcli/main.go | 2 +- tools/relaynode/relaynode.go | 4 ++-- tools/sendDepositTx/sendDeposits.go | 2 +- tools/unencrypted-keys-gen/main.go | 3 +-- tools/unencrypted-keys-gen/main_test.go | 3 ++- validator/main.go | 4 ++-- 29 files changed, 37 insertions(+), 37 deletions(-) diff --git a/beacon-chain/blockchain/init_sync_process_block_test.go b/beacon-chain/blockchain/init_sync_process_block_test.go index 3fefc2d20..c2c36bd6f 100644 --- a/beacon-chain/blockchain/init_sync_process_block_test.go +++ b/beacon-chain/blockchain/init_sync_process_block_test.go @@ -18,7 +18,7 @@ import ( "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil" - messagediff "gopkg.in/d4l3k/messagediff.v1" + "gopkg.in/d4l3k/messagediff.v1" ) func TestFilterBoundaryCandidates_FilterCorrect(t *testing.T) { diff --git a/beacon-chain/blockchain/service_test.go b/beacon-chain/blockchain/service_test.go index ff672562f..6a26d5deb 100644 --- a/beacon-chain/blockchain/service_test.go +++ b/beacon-chain/blockchain/service_test.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/gogo/protobuf/proto" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" - ssz "github.com/prysmaticlabs/go-ssz" + "github.com/prysmaticlabs/go-ssz" "github.com/prysmaticlabs/prysm/beacon-chain/cache" "github.com/prysmaticlabs/prysm/beacon-chain/cache/depositcache" b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" diff --git a/beacon-chain/main.go b/beacon-chain/main.go index ed9de38b3..5b71aa9d8 100644 --- a/beacon-chain/main.go +++ b/beacon-chain/main.go @@ -18,10 +18,10 @@ import ( "github.com/prysmaticlabs/prysm/shared/logutil" "github.com/prysmaticlabs/prysm/shared/version" "github.com/sirupsen/logrus" - prefixed "github.com/x-cray/logrus-prefixed-formatter" - _ "go.uber.org/automaxprocs" "github.com/urfave/cli/v2" "github.com/urfave/cli/v2/altsrc" + prefixed "github.com/x-cray/logrus-prefixed-formatter" + _ "go.uber.org/automaxprocs" ) var appFlags = []cli.Flag{ diff --git a/beacon-chain/p2p/encoder/ssz.go b/beacon-chain/p2p/encoder/ssz.go index ee468779a..81ef0eb07 100644 --- a/beacon-chain/p2p/encoder/ssz.go +++ b/beacon-chain/p2p/encoder/ssz.go @@ -7,7 +7,7 @@ import ( "github.com/gogo/protobuf/proto" "github.com/golang/snappy" - errors "github.com/pkg/errors" + "github.com/pkg/errors" "github.com/prysmaticlabs/go-ssz" "github.com/prysmaticlabs/prysm/shared/params" ) diff --git a/beacon-chain/p2p/service_test.go b/beacon-chain/p2p/service_test.go index be7d124a1..1a4428e6e 100644 --- a/beacon-chain/p2p/service_test.go +++ b/beacon-chain/p2p/service_test.go @@ -10,10 +10,10 @@ import ( "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/enode" - libp2p "github.com/libp2p/go-libp2p" + "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/peer" - multiaddr "github.com/multiformats/go-multiaddr" + "github.com/multiformats/go-multiaddr" mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing" "github.com/prysmaticlabs/prysm/beacon-chain/core/feed" statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state" diff --git a/beacon-chain/p2p/testing/p2p.go b/beacon-chain/p2p/testing/p2p.go index 7d9699854..e46f0241a 100644 --- a/beacon-chain/p2p/testing/p2p.go +++ b/beacon-chain/p2p/testing/p2p.go @@ -21,7 +21,7 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" swarmt "github.com/libp2p/go-libp2p-swarm/testing" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" - peers "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/sirupsen/logrus" ) diff --git a/beacon-chain/rpc/beacon/validators_stream.go b/beacon-chain/rpc/beacon/validators_stream.go index 6f83edf75..c25a19eb1 100644 --- a/beacon-chain/rpc/beacon/validators_stream.go +++ b/beacon-chain/rpc/beacon/validators_stream.go @@ -10,7 +10,7 @@ import ( "sync" "time" - cache "github.com/patrickmn/go-cache" + "github.com/patrickmn/go-cache" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" diff --git a/beacon-chain/sync/subscriber_committee_index_beacon_attestation_test.go b/beacon-chain/sync/subscriber_committee_index_beacon_attestation_test.go index b29bf0ebf..5d7fa77f6 100644 --- a/beacon-chain/sync/subscriber_committee_index_beacon_attestation_test.go +++ b/beacon-chain/sync/subscriber_committee_index_beacon_attestation_test.go @@ -5,8 +5,6 @@ import ( "testing" "time" - "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" - "github.com/prysmaticlabs/prysm/shared/params" lru "github.com/hashicorp/golang-lru" eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/go-bitfield" @@ -14,18 +12,20 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/cache" "github.com/prysmaticlabs/prysm/beacon-chain/core/feed" statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state" + "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" dbtest "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" "github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations" p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" "github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil" mockSync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing" "github.com/prysmaticlabs/prysm/shared/featureconfig" + "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil" ) func TestService_committeeIndexBeaconAttestationSubscriber_ValidMessage(t *testing.T) { t.Skip("Temporarily disabled, fixed in v0.12 branch.") - + p := p2ptest.NewTestP2P(t) resetCfg := featureconfig.InitWithReset(&featureconfig.Flags{DisableDynamicCommitteeSubnets: true}) defer resetCfg() diff --git a/shared/bls/spectest/aggregate_test.go b/shared/bls/spectest/aggregate_test.go index 241fe01c2..228e74753 100644 --- a/shared/bls/spectest/aggregate_test.go +++ b/shared/bls/spectest/aggregate_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/ghodss/yaml" - bls "github.com/prysmaticlabs/prysm/shared/bls" + "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/testutil" ) diff --git a/shared/bls/spectest/aggregate_verify_test.go b/shared/bls/spectest/aggregate_verify_test.go index 39938d40e..dddbf05b6 100644 --- a/shared/bls/spectest/aggregate_verify_test.go +++ b/shared/bls/spectest/aggregate_verify_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/ghodss/yaml" - bls "github.com/prysmaticlabs/prysm/shared/bls" + "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/testutil" ) diff --git a/shared/bls/spectest/fast_aggregate_verify_test.go b/shared/bls/spectest/fast_aggregate_verify_test.go index 9a318ff77..6ea723532 100644 --- a/shared/bls/spectest/fast_aggregate_verify_test.go +++ b/shared/bls/spectest/fast_aggregate_verify_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/ghodss/yaml" - bls "github.com/prysmaticlabs/prysm/shared/bls" + "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/testutil" ) diff --git a/shared/bls/spectest/sign_test.go b/shared/bls/spectest/sign_test.go index d4e114734..e06ef0b69 100644 --- a/shared/bls/spectest/sign_test.go +++ b/shared/bls/spectest/sign_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/ghodss/yaml" - bls "github.com/prysmaticlabs/prysm/shared/bls" + "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/testutil" ) diff --git a/shared/bls/spectest/verify_test.go b/shared/bls/spectest/verify_test.go index 4d467b29d..f9635a0b6 100644 --- a/shared/bls/spectest/verify_test.go +++ b/shared/bls/spectest/verify_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/ghodss/yaml" - bls "github.com/prysmaticlabs/prysm/shared/bls" + "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/testutil" ) diff --git a/slasher/db/kv/proposer_slashings_test.go b/slasher/db/kv/proposer_slashings_test.go index 93b47a379..cdf0d7690 100644 --- a/slasher/db/kv/proposer_slashings_test.go +++ b/slasher/db/kv/proposer_slashings_test.go @@ -9,8 +9,8 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/slasher/db/types" - "gopkg.in/d4l3k/messagediff.v1" "github.com/urfave/cli/v2" + "gopkg.in/d4l3k/messagediff.v1" ) func TestStore_ProposerSlashingNilBucket(t *testing.T) { diff --git a/slasher/detection/attestations/spanner.go b/slasher/detection/attestations/spanner.go index df07e8aaa..0a8d1c828 100644 --- a/slasher/detection/attestations/spanner.go +++ b/slasher/detection/attestations/spanner.go @@ -12,7 +12,7 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/params" - db "github.com/prysmaticlabs/prysm/slasher/db" + "github.com/prysmaticlabs/prysm/slasher/db" "github.com/prysmaticlabs/prysm/slasher/detection/attestations/iface" "github.com/prysmaticlabs/prysm/slasher/detection/attestations/types" "go.opencensus.io/trace" diff --git a/slasher/main.go b/slasher/main.go index 760affb7b..488f38268 100644 --- a/slasher/main.go +++ b/slasher/main.go @@ -17,9 +17,9 @@ import ( "github.com/prysmaticlabs/prysm/slasher/flags" "github.com/prysmaticlabs/prysm/slasher/node" "github.com/sirupsen/logrus" - prefixed "github.com/x-cray/logrus-prefixed-formatter" "github.com/urfave/cli/v2" "github.com/urfave/cli/v2/altsrc" + prefixed "github.com/x-cray/logrus-prefixed-formatter" ) var log = logrus.WithField("prefix", "main") diff --git a/tools/bootnode-query/main.go b/tools/bootnode-query/main.go index 7bd3225a9..c20ce9167 100644 --- a/tools/bootnode-query/main.go +++ b/tools/bootnode-query/main.go @@ -16,7 +16,7 @@ import ( host "github.com/libp2p/go-libp2p-host" dhtpb "github.com/libp2p/go-libp2p-kad-dht/pb" net "github.com/libp2p/go-libp2p-net" - p2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p" + "github.com/prysmaticlabs/prysm/beacon-chain/p2p" ) const dhtProtocol = "/prysm/0.0.0/dht" diff --git a/tools/bootnode/bootnode.go b/tools/bootnode/bootnode.go index 57001e5b0..36209bdd8 100644 --- a/tools/bootnode/bootnode.go +++ b/tools/bootnode/bootnode.go @@ -30,7 +30,7 @@ import ( ds "github.com/ipfs/go-datastore" dsync "github.com/ipfs/go-datastore/sync" logging "github.com/ipfs/go-log" - libp2p "github.com/libp2p/go-libp2p" + "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p-core/crypto" kaddht "github.com/libp2p/go-libp2p-kad-dht" dhtopts "github.com/libp2p/go-libp2p-kad-dht/opts" diff --git a/tools/deployContract/deployContract.go b/tools/deployContract/deployContract.go index dd124b7c6..4f980a2d1 100644 --- a/tools/deployContract/deployContract.go +++ b/tools/deployContract/deployContract.go @@ -18,8 +18,8 @@ import ( contracts "github.com/prysmaticlabs/prysm/contracts/deposit-contract" "github.com/prysmaticlabs/prysm/shared/version" "github.com/sirupsen/logrus" - prefixed "github.com/x-cray/logrus-prefixed-formatter" "github.com/urfave/cli/v2" + prefixed "github.com/x-cray/logrus-prefixed-formatter" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" @@ -199,7 +199,7 @@ func updateKubernetesConfigMap(ctx context.Context, contractAddr string) error { return err } - cm, err := client.CoreV1().ConfigMaps("beacon-chain").Get(ctx,"beacon-config", metav1.GetOptions{}) + cm, err := client.CoreV1().ConfigMaps("beacon-chain").Get(ctx, "beacon-config", metav1.GetOptions{}) if err != nil { return err } diff --git a/tools/drainContracts/drainContracts.go b/tools/drainContracts/drainContracts.go index 477ceac26..530d8189d 100644 --- a/tools/drainContracts/drainContracts.go +++ b/tools/drainContracts/drainContracts.go @@ -21,8 +21,8 @@ import ( contracts "github.com/prysmaticlabs/prysm/contracts/deposit-contract" "github.com/prysmaticlabs/prysm/shared/version" "github.com/sirupsen/logrus" - prefixed "github.com/x-cray/logrus-prefixed-formatter" "github.com/urfave/cli/v2" + prefixed "github.com/x-cray/logrus-prefixed-formatter" ) func main() { diff --git a/tools/faucet/main.go b/tools/faucet/main.go index 925f19343..5c0211890 100644 --- a/tools/faucet/main.go +++ b/tools/faucet/main.go @@ -5,7 +5,7 @@ import ( "fmt" "net" - recaptcha "github.com/prestonvanloon/go-recaptcha" + "github.com/prestonvanloon/go-recaptcha" faucetpb "github.com/prysmaticlabs/prysm/proto/faucet" _ "go.uber.org/automaxprocs" "google.golang.org/grpc" diff --git a/tools/faucet/server.go b/tools/faucet/server.go index aed1730b0..8d5659b35 100644 --- a/tools/faucet/server.go +++ b/tools/faucet/server.go @@ -16,7 +16,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/params" - recaptcha "github.com/prestonvanloon/go-recaptcha" + "github.com/prestonvanloon/go-recaptcha" faucetpb "github.com/prysmaticlabs/prysm/proto/faucet" "github.com/prysmaticlabs/prysm/shared/roughtime" "google.golang.org/grpc/metadata" diff --git a/tools/interop/convert-keys/main.go b/tools/interop/convert-keys/main.go index 73af50063..06dd2d059 100644 --- a/tools/interop/convert-keys/main.go +++ b/tools/interop/convert-keys/main.go @@ -11,7 +11,7 @@ import ( "log" "os" - keygen "github.com/prysmaticlabs/prysm/tools/unencrypted-keys-gen/keygen" + "github.com/prysmaticlabs/prysm/tools/unencrypted-keys-gen/keygen" "gopkg.in/yaml.v2" ) diff --git a/tools/pcli/main.go b/tools/pcli/main.go index fd5377a30..36c2a74c1 100644 --- a/tools/pcli/main.go +++ b/tools/pcli/main.go @@ -16,9 +16,9 @@ import ( pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/version" log "github.com/sirupsen/logrus" + "github.com/urfave/cli/v2" prefixed "github.com/x-cray/logrus-prefixed-formatter" "gopkg.in/d4l3k/messagediff.v1" - "github.com/urfave/cli/v2" ) func main() { diff --git a/tools/relaynode/relaynode.go b/tools/relaynode/relaynode.go index 1a881cce5..2f3a9cd3b 100644 --- a/tools/relaynode/relaynode.go +++ b/tools/relaynode/relaynode.go @@ -14,10 +14,10 @@ import ( "fmt" logging "github.com/ipfs/go-log" - libp2p "github.com/libp2p/go-libp2p" + "github.com/libp2p/go-libp2p" circuit "github.com/libp2p/go-libp2p-circuit" crypto "github.com/libp2p/go-libp2p-crypto" - multiaddr "github.com/multiformats/go-multiaddr" + "github.com/multiformats/go-multiaddr" "github.com/prysmaticlabs/prysm/shared/version" _ "go.uber.org/automaxprocs" ) diff --git a/tools/sendDepositTx/sendDeposits.go b/tools/sendDepositTx/sendDeposits.go index 41fd703dc..d2995ba50 100644 --- a/tools/sendDepositTx/sendDeposits.go +++ b/tools/sendDepositTx/sendDeposits.go @@ -21,8 +21,8 @@ import ( "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/version" "github.com/sirupsen/logrus" - prefixed "github.com/x-cray/logrus-prefixed-formatter" "github.com/urfave/cli/v2" + prefixed "github.com/x-cray/logrus-prefixed-formatter" ) var ( diff --git a/tools/unencrypted-keys-gen/main.go b/tools/unencrypted-keys-gen/main.go index a18d8c3ea..e9974aed9 100644 --- a/tools/unencrypted-keys-gen/main.go +++ b/tools/unencrypted-keys-gen/main.go @@ -2,11 +2,11 @@ package main import ( "flag" - "github.com/prysmaticlabs/prysm/tools/unencrypted-keys-gen/keygen" "log" "os" "github.com/prysmaticlabs/prysm/shared/interop" + "github.com/prysmaticlabs/prysm/tools/unencrypted-keys-gen/keygen" ) var ( @@ -66,4 +66,3 @@ func generateUnencryptedKeys(startIndex uint64) *keygen.UnencryptedKeysContainer } return ctnr } - diff --git a/tools/unencrypted-keys-gen/main_test.go b/tools/unencrypted-keys-gen/main_test.go index 7ad639f3c..6589835b1 100644 --- a/tools/unencrypted-keys-gen/main_test.go +++ b/tools/unencrypted-keys-gen/main_test.go @@ -3,9 +3,10 @@ package main import ( "bytes" "encoding/json" - "github.com/prysmaticlabs/prysm/tools/unencrypted-keys-gen/keygen" "reflect" "testing" + + "github.com/prysmaticlabs/prysm/tools/unencrypted-keys-gen/keygen" ) func TestSavesUnencryptedKeys(t *testing.T) { diff --git a/validator/main.go b/validator/main.go index 0fe834078..33e0f7ef8 100644 --- a/validator/main.go +++ b/validator/main.go @@ -26,11 +26,11 @@ import ( "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/node" "github.com/sirupsen/logrus" + "github.com/urfave/cli/v2" + "github.com/urfave/cli/v2/altsrc" prefixed "github.com/x-cray/logrus-prefixed-formatter" _ "go.uber.org/automaxprocs" "google.golang.org/grpc" - "github.com/urfave/cli/v2" - "github.com/urfave/cli/v2/altsrc" ) var log = logrus.WithField("prefix", "main")