diff --git a/config/config_test.go b/config/config_test.go index f06c2c55..26d15bd3 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -1600,6 +1600,7 @@ func TestCheckExchangeConfigValues(t *testing.T) { } // Make a sneaky copy for bank account testing + // nolint: gocritic cpy := append(cfg.Exchanges[:0:0], cfg.Exchanges...) // Test empty exchange name for an enabled exchange diff --git a/currency/forexprovider/base/base.go b/currency/forexprovider/base/base.go index ff037934..82ac314a 100644 --- a/currency/forexprovider/base/base.go +++ b/currency/forexprovider/base/base.go @@ -4,6 +4,11 @@ import ( "time" ) +// Base enforces standard variables across the provider packages +type Base struct { + Settings `json:"settings"` +} + // GetName returns name of provider func (b *Base) GetName() string { return b.Name @@ -32,8 +37,3 @@ type Settings struct { APIKeyLvl int `json:"apiKeyLvl"` PrimaryProvider bool `json:"primaryProvider"` } - -// Base enforces standard variables across the provider packages -type Base struct { - Settings `json:"settings"` -} diff --git a/currency/forexprovider/forexprovider.go b/currency/forexprovider/forexprovider.go index fdcda7d3..6643d3ba 100644 --- a/currency/forexprovider/forexprovider.go +++ b/currency/forexprovider/forexprovider.go @@ -14,6 +14,11 @@ import ( "github.com/thrasher-corp/gocryptotrader/currency/forexprovider/openexchangerates" ) +// ForexProviders is a foreign exchange handler type +type ForexProviders struct { + base.FXHandler +} + // GetSupportedForexProviders returns a list of supported forex providers func GetSupportedForexProviders() []string { return []string{ @@ -145,8 +150,3 @@ func StartFXService(fxProviders []base.Settings) (*ForexProviders, error) { return handler, nil } - -// ForexProviders is a foreign exchange handler type -type ForexProviders struct { - base.FXHandler -} diff --git a/exchanges/bittrex/bittrex_wrapper.go b/exchanges/bittrex/bittrex_wrapper.go index b412deb6..44d04d24 100644 --- a/exchanges/bittrex/bittrex_wrapper.go +++ b/exchanges/bittrex/bittrex_wrapper.go @@ -445,6 +445,7 @@ func (b *Bittrex) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory if err != nil { return resp, err } + // nolint: gocritic depositData := append(closedDepositData, openDepositData...) for x := range depositData { @@ -468,6 +469,7 @@ func (b *Bittrex) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory if err != nil { return resp, err } + // nolint: gocritic withdrawalData := append(closedWithdrawalData, openWithdrawalData...) for x := range withdrawalData { diff --git a/exchanges/orderbook/orderbook_test.go b/exchanges/orderbook/orderbook_test.go index 21717d7b..162596e4 100644 --- a/exchanges/orderbook/orderbook_test.go +++ b/exchanges/orderbook/orderbook_test.go @@ -652,6 +652,7 @@ func BenchmarkReverse(b *testing.B) { func BenchmarkSortAsksDecending(b *testing.B) { s := deploySliceOrdered() for i := 0; i < b.N; i++ { + // nolint: gocritic ts := append(s[:0:0], s...) ts.SortAsks() } @@ -662,6 +663,7 @@ func BenchmarkSortBidsAscending(b *testing.B) { s := deploySliceOrdered() s.Reverse() for i := 0; i < b.N; i++ { + // nolint: gocritic ts := append(s[:0:0], s...) ts.SortBids() } @@ -671,6 +673,7 @@ func BenchmarkSortBidsAscending(b *testing.B) { func BenchmarkSortAsksStandard(b *testing.B) { s := deployUnorderedSlice() for i := 0; i < b.N; i++ { + // nolint: gocritic ts := append(s[:0:0], s...) ts.SortAsks() } @@ -680,6 +683,7 @@ func BenchmarkSortAsksStandard(b *testing.B) { func BenchmarkSortBidsStandard(b *testing.B) { s := deployUnorderedSlice() for i := 0; i < b.N; i++ { + // nolint: gocritic ts := append(s[:0:0], s...) ts.SortBids() } @@ -689,6 +693,7 @@ func BenchmarkSortBidsStandard(b *testing.B) { func BenchmarkSortAsksAscending(b *testing.B) { s := deploySliceOrdered() for i := 0; i < b.N; i++ { + // nolint: gocritic ts := append(s[:0:0], s...) ts.SortAsks() } @@ -699,6 +704,7 @@ func BenchmarkSortBidsDescending(b *testing.B) { s := deploySliceOrdered() s.Reverse() for i := 0; i < b.N; i++ { + // nolint: gocritic ts := append(s[:0:0], s...) ts.SortBids() } diff --git a/exchanges/orderbook/unsafe_test.go b/exchanges/orderbook/unsafe_test.go index 3188787b..54cefeb4 100644 --- a/exchanges/orderbook/unsafe_test.go +++ b/exchanges/orderbook/unsafe_test.go @@ -22,7 +22,7 @@ func TestUnsafe(t *testing.T) { ob2 := &externalBook{} ob.Lock() - ob.Unlock() // nolint:staticcheck // Not needed in test + ob.Unlock() // nolint:staticcheck, gocritic // Not needed in test ob.LockWith(ob2) ob.UnlockWith(ob2) } diff --git a/exchanges/stream/buffer/buffer_test.go b/exchanges/stream/buffer/buffer_test.go index 16835415..ae91ff1d 100644 --- a/exchanges/stream/buffer/buffer_test.go +++ b/exchanges/stream/buffer/buffer_test.go @@ -794,6 +794,7 @@ func TestUpdateByIDAndAction(t *testing.T) { holder := orderbookHolder{} asks := deploySliceOrdered(100) + // nolint: gocritic bids := append(asks[:0:0], asks...) bids.Reverse() diff --git a/exchanges/ticker/ticker.go b/exchanges/ticker/ticker.go index 373fb704..0a437707 100644 --- a/exchanges/ticker/ticker.go +++ b/exchanges/ticker/ticker.go @@ -180,6 +180,7 @@ func (s *Service) update(p *Price) error { } t.Price = *p + // nolint: gocritic ids := append(t.Assoc, t.Main) s.Unlock() return s.mux.Publish(ids, p) diff --git a/exchanges/trade/trade.go b/exchanges/trade/trade.go index f85c8273..1aa09777 100644 --- a/exchanges/trade/trade.go +++ b/exchanges/trade/trade.go @@ -100,6 +100,7 @@ func (p *Processor) Run(wg *sync.WaitGroup) { for { <-ticker.C p.mutex.Lock() + // nolint: gocritic bufferCopy := append(p.buffer[:0:0], p.buffer...) p.buffer = nil p.mutex.Unlock()