mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-29 15:10:37 +00:00
golangci-lint/CI: Bump versions and introduce new linters (#798)
* golangci-lint/CI: Bump versions
Fix remaining linter issues
* Specifically set AppVeyor version
* Fix the infamous typos 👀
* Add go env cmd to AppVeyor
* Add go version cmd to AppVeyor
* Specify AppVeyor image, adjust linters
* Update go get to go install due to deprecation
* Bump golangci-lint timeout time for AppVeyor
* Change NW contract to NQ
* Address nitters
* GetRandomPair -> Pair{}
* Address nits
* Address time nitterinos plus additional tweaks
* More time inception upgrades!
* Bending time and space
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestLinearBackoff(t *testing.T) {
|
||||
t.Parallel()
|
||||
type args struct {
|
||||
Backoff request.Backoff
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ func (r *Requester) GetNonce(isNano bool) nonce.Value {
|
||||
func (r *Requester) GetNonceMilli() nonce.Value {
|
||||
r.timedLock.LockForDuration()
|
||||
if r.Nonce.Get() == 0 {
|
||||
r.Nonce.Set(time.Now().UnixNano() / int64(time.Millisecond))
|
||||
r.Nonce.Set(time.Now().UnixMilli())
|
||||
return r.Nonce.Get()
|
||||
}
|
||||
return r.Nonce.GetInc()
|
||||
|
||||
@@ -484,18 +484,14 @@ func TestGetNonce(t *testing.T) {
|
||||
new(http.Client),
|
||||
WithLimiter(&globalshell))
|
||||
|
||||
n1 := r.GetNonce(false)
|
||||
n2 := r.GetNonce(false)
|
||||
if n1 == n2 {
|
||||
if n1, n2 := r.GetNonce(false), r.GetNonce(false); n1 == n2 {
|
||||
t.Fatal(unexpected)
|
||||
}
|
||||
|
||||
r2 := New("test",
|
||||
new(http.Client),
|
||||
WithLimiter(&globalshell))
|
||||
n3 := r2.GetNonce(true)
|
||||
n4 := r2.GetNonce(true)
|
||||
if n3 == n4 {
|
||||
if n1, n2 := r2.GetNonce(true), r2.GetNonce(true); n1 == n2 {
|
||||
t.Fatal(unexpected)
|
||||
}
|
||||
}
|
||||
@@ -505,9 +501,7 @@ func TestGetNonceMillis(t *testing.T) {
|
||||
r := New("test",
|
||||
new(http.Client),
|
||||
WithLimiter(&globalshell))
|
||||
m1 := r.GetNonceMilli()
|
||||
m2 := r.GetNonceMilli()
|
||||
if m1 == m2 {
|
||||
if m1, m2 := r.GetNonceMilli(), r.GetNonceMilli(); m1 == m2 {
|
||||
log.Fatal(unexpected)
|
||||
}
|
||||
}
|
||||
@@ -562,7 +556,7 @@ func TestBasicLimiter(t *testing.T) {
|
||||
defer cancel()
|
||||
err = r.SendPayload(ctx, Unset, func() (*Item, error) { return &i, nil })
|
||||
if !errors.Is(err, context.DeadlineExceeded) {
|
||||
t.Fatalf("receieved: %v but expected: %v", err, context.DeadlineExceeded)
|
||||
t.Fatalf("received: %v but expected: %v", err, context.DeadlineExceeded)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDefaultRetryPolicy(t *testing.T) {
|
||||
t.Parallel()
|
||||
type args struct {
|
||||
Error error
|
||||
Response *http.Response
|
||||
@@ -70,6 +71,7 @@ func TestDefaultRetryPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetryAfter(t *testing.T) {
|
||||
t.Parallel()
|
||||
now := time.Date(2020, time.April, 20, 13, 31, 13, 0, time.UTC)
|
||||
|
||||
type args struct {
|
||||
|
||||
Reference in New Issue
Block a user