Skip to content

Commit b7eaab5

Browse files
all: fix linting issues
1 parent 6777225 commit b7eaab5

File tree

5 files changed

+40
-83
lines changed

5 files changed

+40
-83
lines changed

.github/workflow/build-push.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ linters:
2424
- durationcheck
2525
- exportloopref
2626
- whitespace
27+
# this repo contains a few copied files from go-ethereum,
28+
# and some of them have unused fields/functions
29+
- unused
2730

2831
# - structcheck # lots of false positives
2932
# - errcheck #lot of false positives

cmd/crawler/api.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ func transferNewNodes(crawlerDB, nodeDB *sql.DB) error {
8787
// they are normally recoverable, and a lot of the time, it's
8888
// because the database is locked by the crawler.
8989
return fmt.Errorf("error starting transaction to read nodes: %w", err)
90-
9190
}
9291
defer crawlerDBTx.Rollback()
9392

pkg/crawler/crawl.go

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -175,52 +175,49 @@ func (c *crawler) runIterator(done chan<- enode.Iterator, it enode.Iterator) {
175175

176176
func (c *crawler) getClientInfoLoop() {
177177
defer func() { c.Done() }()
178-
for {
179-
select {
180-
case n, ok := <-c.reqCh:
181-
if !ok {
182-
return
183-
}
178+
for n := range c.reqCh {
179+
if n == nil {
180+
return
181+
}
184182

185-
var tooManyPeers bool
186-
var scoreInc int
183+
var tooManyPeers bool
184+
var scoreInc int
187185

188-
info, err := getClientInfo(c.genesis, c.networkID, c.nodeURL, n)
189-
if err != nil {
190-
log.Warn("GetClientInfo failed", "error", err, "nodeID", n.ID())
191-
if strings.Contains(err.Error(), "too many peers") {
192-
tooManyPeers = true
193-
}
194-
} else {
195-
scoreInc = 10
186+
info, err := getClientInfo(c.genesis, c.networkID, c.nodeURL, n)
187+
if err != nil {
188+
log.Warn("GetClientInfo failed", "error", err, "nodeID", n.ID())
189+
if strings.Contains(err.Error(), "too many peers") {
190+
tooManyPeers = true
196191
}
192+
} else {
193+
scoreInc = 10
194+
}
197195

198-
if info != nil {
199-
log.Info(
200-
"Updating node info",
201-
"client_type", info.ClientType,
202-
"version", info.SoftwareVersion,
203-
"network_id", info.NetworkID,
204-
"caps", info.Capabilities,
205-
"fork_id", info.ForkID,
206-
"height", info.Blockheight,
207-
"td", info.TotalDifficulty,
208-
"head", info.HeadHash,
209-
)
210-
}
196+
if info != nil {
197+
log.Info(
198+
"Updating node info",
199+
"client_type", info.ClientType,
200+
"version", info.SoftwareVersion,
201+
"network_id", info.NetworkID,
202+
"caps", info.Capabilities,
203+
"fork_id", info.ForkID,
204+
"height", info.Blockheight,
205+
"td", info.TotalDifficulty,
206+
"head", info.HeadHash,
207+
)
208+
}
211209

212-
c.Lock()
213-
node := c.output[n.ID()]
214-
node.N = n
215-
node.Seq = n.Seq()
216-
if info != nil {
217-
node.Info = info
218-
}
219-
node.TooManyPeers = tooManyPeers
220-
node.Score += scoreInc
221-
c.output[n.ID()] = node
222-
c.Unlock()
210+
c.Lock()
211+
node := c.output[n.ID()]
212+
node.N = n
213+
node.Seq = n.Seq()
214+
if info != nil {
215+
node.Info = info
223216
}
217+
node.TooManyPeers = tooManyPeers
218+
node.Score += scoreInc
219+
c.output[n.ID()] = node
220+
c.Unlock()
224221
}
225222
}
226223

pkg/vparser/vparser_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
)
77

88
func TestParseVersionString(t *testing.T) {
9-
109
type ParseTestCase struct {
1110
name string
1211
args string

0 commit comments

Comments
 (0)