From 549fe06339d37a1bd3a68867acae974db0bccf40 Mon Sep 17 00:00:00 2001 From: Adam Babik Date: Fri, 6 Dec 2019 10:59:29 +0100 Subject: [PATCH] fix linter gocyclo error for bootnode --- cmd/bootnode/main.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go index 4d291917e..d113c6996 100644 --- a/cmd/bootnode/main.go +++ b/cmd/bootnode/main.go @@ -14,6 +14,19 @@ import ( "github.com/ethereum/go-ethereum/p2p/discv5" ) +var ( + writeAddr = flag.Bool("writeaddress", false, "write out the node's public key and quit") + listenAddr = flag.String("addr", ":30301", "listen address") + genKeyFile = flag.String("genkey", "", "generate a node key") + nodeKeyFile = flag.String("nodekey", "", "private key filename") + keydata = flag.String("keydata", "", "hex encoded private key") + verbosity = flag.Int("verbosity", int(log.LvlInfo), "log verbosity (0-9)") + vmodule = flag.String("vmodule", "", "log verbosity pattern") + nursery = bootnodes{} + nodeKey *ecdsa.PrivateKey + err error +) + type bootnodes []*discv5.Node func (f *bootnodes) String() string { @@ -30,19 +43,7 @@ func (f *bootnodes) Set(value string) error { return nil } -func main() { - var ( - writeAddr = flag.Bool("writeaddress", false, "write out the node's public key and quit") - listenAddr = flag.String("addr", ":30301", "listen address") - genKeyFile = flag.String("genkey", "", "generate a node key") - nodeKeyFile = flag.String("nodekey", "", "private key filename") - keydata = flag.String("keydata", "", "hex encoded private key") - verbosity = flag.Int("verbosity", int(log.LvlInfo), "log verbosity (0-9)") - vmodule = flag.String("vmodule", "", "log verbosity pattern") - nursery = bootnodes{} - nodeKey *ecdsa.PrivateKey - err error - ) +func main() { // nolint: gocyclo flag.Var(&nursery, "n", "These nodes are used to connect to the network if the table is empty and there are no known nodes in the database.") flag.Parse() @@ -106,5 +107,6 @@ func main() { if err := tab.SetFallbackNodes(nursery); err != nil { log.Crit("Failed to set fallback", "nodes", nursery, "error", err) } + select {} }