From a7200699ddc075ec1cb48308fc98eb966ce7c940 Mon Sep 17 00:00:00 2001 From: Zach Ramsay Date: Mon, 11 Dec 2017 14:08:41 +0000 Subject: [PATCH] all: more gosimple lints --- cmd/faucet/faucet.go | 2 +- p2p/discv5/net.go | 2 +- p2p/discv5/ntp.go | 8 ++++---- p2p/discv5/ticket.go | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/faucet/faucet.go b/cmd/faucet/faucet.go index 328029fdf6..dc13bc3317 100644 --- a/cmd/faucet/faucet.go +++ b/cmd/faucet/faucet.go @@ -506,7 +506,7 @@ func (f *faucet) apiHandler(conn *websocket.Conn) { // Send an error if too frequent funding, othewise a success if !fund { - if err = sendError(conn, fmt.Errorf("%s left until next allowance", common.PrettyDuration(timeout.Sub(time.Now())))); err != nil { + if err = sendError(conn, fmt.Errorf("%s left until next allowance", common.PrettyDuration(time.Until(timeout)))); err != nil { log.Warn("Failed to send funding error to client", "err", err) return } diff --git a/p2p/discv5/net.go b/p2p/discv5/net.go index a39cfcc645..2fbb60824c 100644 --- a/p2p/discv5/net.go +++ b/p2p/discv5/net.go @@ -684,7 +684,7 @@ func (net *Network) refresh(done chan<- struct{}) { seeds = net.nursery } if len(seeds) == 0 { - log.Trace(fmt.Sprint("no seed nodes found")) + log.Trace("no seed nodes found") close(done) return } diff --git a/p2p/discv5/ntp.go b/p2p/discv5/ntp.go index f78d5dc43c..4fb5f657ae 100644 --- a/p2p/discv5/ntp.go +++ b/p2p/discv5/ntp.go @@ -54,10 +54,10 @@ func checkClockDrift() { howtofix := fmt.Sprintf("Please enable network time synchronisation in system settings") separator := strings.Repeat("-", len(warning)) - log.Warn(fmt.Sprint(separator)) - log.Warn(fmt.Sprint(warning)) - log.Warn(fmt.Sprint(howtofix)) - log.Warn(fmt.Sprint(separator)) + log.Warn(separator) + log.Warn(warning) + log.Warn(howtofix) + log.Warn(separator) } else { log.Debug(fmt.Sprintf("Sanity NTP check reported %v drift, all ok", drift)) } diff --git a/p2p/discv5/ticket.go b/p2p/discv5/ticket.go index 48dd114f06..193cef4be5 100644 --- a/p2p/discv5/ticket.go +++ b/p2p/discv5/ticket.go @@ -398,12 +398,12 @@ func (s *ticketStore) nextRegisterableTicket() (t *ticketRef, wait time.Duration //s.removeExcessTickets(topic) if len(tickets.buckets) != 0 { empty = false - if list := tickets.buckets[bucket]; list != nil { - for _, ref := range list { - //debugLog(fmt.Sprintf(" nrt bucket = %d node = %x sn = %v wait = %v", bucket, ref.t.node.ID[:8], ref.t.serial, time.Duration(ref.topicRegTime()-now))) - if nextTicket.t == nil || ref.topicRegTime() < nextTicket.topicRegTime() { - nextTicket = ref - } + + list := tickets.buckets[bucket] + for _, ref := range list { + //debugLog(fmt.Sprintf(" nrt bucket = %d node = %x sn = %v wait = %v", bucket, ref.t.node.ID[:8], ref.t.serial, time.Duration(ref.topicRegTime()-now))) + if nextTicket.t == nil || ref.topicRegTime() < nextTicket.topicRegTime() { + nextTicket = ref } } }