Skip to content

Commit

Permalink
Update golangci-lint to update gosec (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview authored Sep 5, 2024
1 parent 062c0d9 commit 462ff0a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
version: v1.60.3
# use the default if on main branch, otherwise use the pull request config
args: --timeout=30m --config=.golangci.yml
only-new-issues: true
Expand Down
7 changes: 6 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ linters:
- staticcheck
- bidichk
- durationcheck
- exportloopref
- copyloopvar
- whitespace
- gosec

Expand All @@ -38,6 +38,11 @@ linters:
linters-settings:
gofmt:
simplify: true
gosec:
excludes:
- G115
- G406 # ignore ripe160 deprecation
- G507 # ignore ripe160 deprecation

issues:
max-issues-per-linter: 1000
Expand Down
8 changes: 4 additions & 4 deletions cmd/thor/sync_logdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ func verifyLogDBPerBlock(
) error {
convertTopics := func(topics []thor.Bytes32) (r [5]*thor.Bytes32) {
for i, t := range topics {
t := t
r[i] = &t
topic := t
r[i] = &topic
}
return
}
Expand Down Expand Up @@ -378,9 +378,9 @@ func pumpBlockAndReceipts(ctx context.Context, repo *chain.Repository, headID th
h.ID()
}
for _, tx := range b.Transactions() {
tx := tx
tmpTx := tx
queue <- func() {
tx.ID()
tmpTx.ID()
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions comm/communicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,21 @@ func (c *Communicator) BroadcastBlock(blk *block.Block) {
toAnnounce := peers[p:]

for _, peer := range toPropagate {
peer := peer
peer.MarkBlock(blk.Header().ID())
tmpPeer := peer
tmpPeer.MarkBlock(blk.Header().ID())
c.goes.Go(func() {
if err := proto.NotifyNewBlock(c.ctx, peer, blk); err != nil {
peer.logger.Debug("failed to broadcast new block", "err", err)
if err := proto.NotifyNewBlock(c.ctx, tmpPeer, blk); err != nil {
tmpPeer.logger.Debug("failed to broadcast new block", "err", err)
}
})
}

for _, peer := range toAnnounce {
peer := peer
peer.MarkBlock(blk.Header().ID())
tmpPeer := peer
tmpPeer.MarkBlock(blk.Header().ID())
c.goes.Go(func() {
if err := proto.NotifyNewBlockID(c.ctx, peer, blk.Header().ID()); err != nil {
peer.logger.Debug("failed to broadcast new block id", "err", err)
if err := proto.NotifyNewBlockID(c.ctx, tmpPeer, blk.Header().ID()); err != nil {
tmpPeer.logger.Debug("failed to broadcast new block id", "err", err)
}
})
}
Expand Down
10 changes: 5 additions & 5 deletions comm/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ func warmupBlocks(ctx context.Context, fetched <-chan []*block.Block, warmedUp c
h.Beta()
}
for _, tx := range blk.Transactions() {
tx := tx
tmpTx := tx
queue <- func() {
tx.ID()
tx.UnprovedWork()
_, _ = tx.IntrinsicGas()
_, _ = tx.Delegator()
tmpTx.ID()
tmpTx.UnprovedWork()
_, _ = tmpTx.IntrinsicGas()
_, _ = tmpTx.Delegator()
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions comm/txs_loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ func (c *Communicator) txsLoop() {
})

for _, peer := range peers {
peer := peer
peer.MarkTransaction(tx.Hash())
tmpPeer := peer
tmpPeer.MarkTransaction(tx.Hash())
c.goes.Go(func() {
if err := proto.NotifyNewTx(c.ctx, peer, tx); err != nil {
peer.logger.Debug("failed to broadcast tx", "err", err)
if err := proto.NotifyNewTx(c.ctx, tmpPeer, tx); err != nil {
tmpPeer.logger.Debug("failed to broadcast tx", "err", err)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion tracers/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func formatLogs(logs []StructLog) []StructLogRes {
}
formatted[index].Stack = &stack
}
if trace.ReturnData != nil && len(trace.ReturnData) > 0 {
if len(trace.ReturnData) > 0 {
formatted[index].ReturnData = hexutil.Bytes(trace.ReturnData).String()
}
if trace.Memory != nil {
Expand Down

0 comments on commit 462ff0a

Please sign in to comment.