Skip to content

Commit

Permalink
linter/config: Fix new linter issue and use versionSize const
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- committed Feb 28, 2025
1 parent 175e53c commit 75ee9bd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
9 changes: 0 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,12 @@ issues:
- text: 'shadow: declaration of "err" shadows declaration at'
linters: [ govet ]


exclude-dirs:
- vendor
- web/
- testdata
- database/models/

# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:
# The following silences false positives in table tests
# https://github.com/kyoh86/scopelint/issues/4
- Using the variable on range scope `ti` in function literal
include:
- EXC0012 # revive: Comment exported (.+) should have comment( \(or a comment on this block\))? or be unexported
- EXC0014 # revive: Comment on exported (.+) should be of the form "(.+)..."
2 changes: 1 addition & 1 deletion backtester/btrpc/btrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ syntax = "proto3";
package btrpc;

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/thrasher-corp/gocryptotrader/backtester/btrpc";

Expand Down
4 changes: 2 additions & 2 deletions config/config_encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ func (c *Config) decryptConfigData(d, key []byte) ([]byte, error) {
}
} else {
d = d[len(encryptionVersionPrefix):]
switch ver := binary.BigEndian.Uint16(d[:2]); ver {
switch ver := binary.BigEndian.Uint16(d[:versionSize]); ver {
case 1: // TODO: Add support for version migration
d = d[2:]
d = d[versionSize:]
ciphertext, err = decryptAESGCMCiphertext(d, key)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions exchanges/bitfinex/bitfinex_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,11 +950,11 @@ func (b *Bitfinex) handleWSAllTrades(s *subscription.Subscription, respRaw []byt
var wsTrades []*wsTrade
switch valueType {
case jsonparser.String:
if t, err := b.handleWSPublicTradeUpdate(respRaw); err != nil {
t, err := b.handleWSPublicTradeUpdate(respRaw)
if err != nil {
return fmt.Errorf("%w `tradesUpdate[2]`: %w", errParsingWSField, err)
} else {
wsTrades = []*wsTrade{t}
}
wsTrades = []*wsTrade{t}
case jsonparser.Array:
if wsTrades, err = b.handleWSPublicTradesSnapshot(v); err != nil {
return fmt.Errorf("%w `tradesSnapshot`: %w", errParsingWSField, err)
Expand Down

0 comments on commit 75ee9bd

Please sign in to comment.