gocritic: linter silence (#796)

This commit is contained in:
Luis Rascão
2021-10-07 04:37:55 +01:00
committed by GitHub
parent 4f0d5d175c
commit 4caa1125bc
9 changed files with 23 additions and 11 deletions

View File

@@ -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

View File

@@ -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"`
}

View File

@@ -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
}

View File

@@ -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 {

View File

@@ -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()
}

View File

@@ -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)
}

View File

@@ -794,6 +794,7 @@ func TestUpdateByIDAndAction(t *testing.T) {
holder := orderbookHolder{}
asks := deploySliceOrdered(100)
// nolint: gocritic
bids := append(asks[:0:0], asks...)
bids.Reverse()

View File

@@ -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)

View File

@@ -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()