Skip to content

Commit 311c8a8

Browse files
committed
linter/config: Fix new linter issue and use versionSize const
1 parent f1671f9 commit 311c8a8

4 files changed

Lines changed: 6 additions & 15 deletions

File tree

.golangci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,21 +154,12 @@ issues:
154154
- text: 'shadow: declaration of "err" shadows declaration at'
155155
linters: [ govet ]
156156

157-
158157
exclude-dirs:
159158
- vendor
160159
- web/
161160
- testdata
162161
- database/models/
163162

164-
# List of regexps of issue texts to exclude, empty list by default.
165-
# But independently from this option we use default exclude patterns,
166-
# it can be disabled by `exclude-use-default: false`. To list all
167-
# excluded by default patterns execute `golangci-lint run --help`
168-
exclude:
169-
# The following silences false positives in table tests
170-
# https://github.com/kyoh86/scopelint/issues/4
171-
- Using the variable on range scope `ti` in function literal
172163
include:
173164
- EXC0012 # revive: Comment exported (.+) should have comment( \(or a comment on this block\))? or be unexported
174165
- EXC0014 # revive: Comment on exported (.+) should be of the form "(.+)..."

backtester/btrpc/btrpc.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ syntax = "proto3";
33
package btrpc;
44

55
import "google/api/annotations.proto";
6-
import "google/protobuf/timestamp.proto";
76
import "google/protobuf/duration.proto";
7+
import "google/protobuf/timestamp.proto";
88

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

config/config_encryption.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ func (c *Config) decryptConfigData(d, key []byte) ([]byte, error) {
184184
}
185185
} else {
186186
d = d[len(encryptionVersionPrefix):]
187-
switch ver := binary.BigEndian.Uint16(d[:2]); ver {
187+
switch ver := binary.BigEndian.Uint16(d[:versionSize]); ver {
188188
case 1: // TODO: Add support for version migration
189-
d = d[2:]
189+
d = d[versionSize:]
190190
ciphertext, err = decryptAESGCMCiphertext(d, key)
191191
if err != nil {
192192
return nil, err

exchanges/bitfinex/bitfinex_websocket.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,11 +950,11 @@ func (b *Bitfinex) handleWSAllTrades(s *subscription.Subscription, respRaw []byt
950950
var wsTrades []*wsTrade
951951
switch valueType {
952952
case jsonparser.String:
953-
if t, err := b.handleWSPublicTradeUpdate(respRaw); err != nil {
953+
t, err := b.handleWSPublicTradeUpdate(respRaw)
954+
if err != nil {
954955
return fmt.Errorf("%w `tradesUpdate[2]`: %w", errParsingWSField, err)
955-
} else {
956-
wsTrades = []*wsTrade{t}
957956
}
957+
wsTrades = []*wsTrade{t}
958958
case jsonparser.Array:
959959
if wsTrades, err = b.handleWSPublicTradesSnapshot(v); err != nil {
960960
return fmt.Errorf("%w `tradesSnapshot`: %w", errParsingWSField, err)

0 commit comments

Comments
 (0)