Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
zivkovicmilos committed Nov 4, 2024
1 parent 19b7a0d commit fd7e7a0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ linters:
- bidichk # Checks for dangerous unicode character sequences
- durationcheck # Check for two durations multiplied together
- errcheck # Forces to not skip error check
- exportloopref # Checks for pointers to enclosing loop variables
- copyloopvar # Checks for pointers to enclosing loop variables
- gocritic # Bundles different linting checks
- godot # Checks for periods at the end of comments
- gomoddirectives # Allow or ban replace directives in go.mod
Expand Down
12 changes: 10 additions & 2 deletions backup/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ func TestBackup_ExecuteBackup_FixedRange(t *testing.T) {
}

assert.Equal(t, exampleTx, txData.Tx)
assert.Equal(t, blockTime.Add(time.Duration(expectedBlock)*time.Minute).Local(), time.UnixMilli(txData.Metadata.Timestamp))
assert.Equal(
t,
blockTime.Add(time.Duration(expectedBlock)*time.Minute).Local(),
time.UnixMilli(txData.Metadata.Timestamp),
)

expectedBlock++
}
Expand Down Expand Up @@ -259,7 +263,11 @@ func TestBackup_ExecuteBackup_Watch(t *testing.T) {
}

assert.Equal(t, exampleTx, txData.Tx)
assert.Equal(t, blockTime.Add(time.Duration(expectedBlock)*time.Minute).Local(), time.UnixMilli(txData.Metadata.Timestamp))
assert.Equal(
t,
blockTime.Add(time.Duration(expectedBlock)*time.Minute).Local(),
time.UnixMilli(txData.Metadata.Timestamp),
)

expectedBlock++
}
Expand Down
4 changes: 2 additions & 2 deletions backup/client/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ func (c *Client) GetLatestBlockNumber() (uint64, error) {
)
}

return uint64(status.SyncInfo.LatestBlockHeight), nil
return uint64(status.SyncInfo.LatestBlockHeight), nil //nolint:gosec // This insanity is a necessary evil
}

func (c *Client) GetBlock(blockNum uint64) (*client.Block, error) {
// Fetch the block
blockNumInt64 := int64(blockNum)
blockNumInt64 := int64(blockNum) //nolint:gosec // This insanity is a necessary evil

block, err := c.client.Block(&blockNumInt64)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (c *backupCfg) exec(ctx context.Context, _ []string) error {
cfg.Watch = c.watch

if c.toBlock >= 0 {
to64 := uint64(c.toBlock)
to64 := uint64(c.toBlock) //nolint:gosec // This insanity is a necessary evil
cfg.ToBlock = &to64
}

Expand Down

0 comments on commit fd7e7a0

Please sign in to comment.