aboutsummaryrefslogtreecommitdiffstats
path: root/ethstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-06 23:44:20 +0800
committerFelix Lange <fjl@twurst.com>2017-01-07 01:18:07 +0800
commitf2da6581ba827a2aab091f764ace8017b26450d8 (patch)
tree3bf7ed2ec48812064c5eb6191c9848ad7985561b /ethstats
parent35a7dcb162546f7f31cb6492f716cb93159218d7 (diff)
downloaddexon-f2da6581ba827a2aab091f764ace8017b26450d8.tar.gz
dexon-f2da6581ba827a2aab091f764ace8017b26450d8.tar.zst
dexon-f2da6581ba827a2aab091f764ace8017b26450d8.zip
all: fix issues reported by honnef.co/go/simple/cmd/gosimple
Diffstat (limited to 'ethstats')
-rw-r--r--ethstats/ethstats.go29
1 files changed, 6 insertions, 23 deletions
diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go
index b802d347f..8692a43bd 100644
--- a/ethstats/ethstats.go
+++ b/ethstats/ethstats.go
@@ -388,10 +388,7 @@ func (s *Service) reportLatency(out *json.Encoder) error {
"latency": strconv.Itoa(int((time.Since(start) / time.Duration(2)).Nanoseconds() / 1000000)),
}},
}
- if err := out.Encode(latency); err != nil {
- return err
- }
- return nil
+ return out.Encode(latency)
}
// blockStats is the information to report about individual blocks.
@@ -440,10 +437,7 @@ func (s *Service) reportBlock(out *json.Encoder, block *types.Block) error {
report := map[string][]interface{}{
"emit": {"block", stats},
}
- if err := out.Encode(report); err != nil {
- return err
- }
- return nil
+ return out.Encode(report)
}
// assembleBlockStats retrieves any required metadata to report a single block
@@ -497,9 +491,7 @@ func (s *Service) reportHistory(out *json.Encoder, list []uint64) error {
indexes := make([]uint64, 0, historyUpdateRange)
if len(list) > 0 {
// Specific indexes requested, send them back in particular
- for _, idx := range list {
- indexes = append(indexes, idx)
- }
+ indexes = append(indexes, list...)
} else {
// No indexes requested, send back the top ones
var head *types.Header
@@ -533,10 +525,7 @@ func (s *Service) reportHistory(out *json.Encoder, list []uint64) error {
report := map[string][]interface{}{
"emit": {"history", stats},
}
- if err := out.Encode(report); err != nil {
- return err
- }
- return nil
+ return out.Encode(report)
}
// pendStats is the information to report about pending transactions.
@@ -564,10 +553,7 @@ func (s *Service) reportPending(out *json.Encoder) error {
report := map[string][]interface{}{
"emit": {"pending", stats},
}
- if err := out.Encode(report); err != nil {
- return err
- }
- return nil
+ return out.Encode(report)
}
// blockStats is the information to report about the local node.
@@ -618,8 +604,5 @@ func (s *Service) reportStats(out *json.Encoder) error {
report := map[string][]interface{}{
"emit": {"stats", stats},
}
- if err := out.Encode(report); err != nil {
- return err
- }
- return nil
+ return out.Encode(report)
}