mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-28 15:10:32 +00:00
linter: Enable gofumpt and run against codebase (#1848)
* linter: Enable gofumpt and run against codebase * Address shazbert's nits * gofumpt: Fix issues after rebase
This commit is contained in:
@@ -143,7 +143,7 @@ func RateLimit(ctx context.Context, rateLimiter *RateLimiterWithWeight) error {
|
||||
}
|
||||
|
||||
var finalDelay time.Duration
|
||||
var reservations = make(Reservations, rateLimiter.Weight)
|
||||
reservations := make(Reservations, rateLimiter.Weight)
|
||||
for i := Weight(0); i < rateLimiter.Weight; i++ {
|
||||
// Consume 1 weight at a time as this avoids needing burst capacity in the limiter,
|
||||
// which would otherwise allow the rate limit to be exceeded over short periods
|
||||
|
||||
@@ -26,8 +26,10 @@ import (
|
||||
|
||||
const unexpected = "unexpected values"
|
||||
|
||||
var testURL string
|
||||
var serverLimit *RateLimiterWithWeight
|
||||
var (
|
||||
testURL string
|
||||
serverLimit *RateLimiterWithWeight
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
serverLimitInterval := time.Millisecond * 500
|
||||
@@ -202,7 +204,8 @@ func TestCheckRequest(t *testing.T) {
|
||||
|
||||
var globalshell = RateLimitDefinitions{
|
||||
Auth: NewWeightedRateLimitByDuration(time.Millisecond * 600),
|
||||
UnAuth: NewRateLimitWithWeight(time.Second*1, 100, 1)}
|
||||
UnAuth: NewRateLimitWithWeight(time.Second*1, 100, 1),
|
||||
}
|
||||
|
||||
func TestDoRequest(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -301,7 +304,7 @@ func TestDoRequest(t *testing.T) {
|
||||
}
|
||||
|
||||
// Check header contents
|
||||
var passback = http.Header{}
|
||||
passback := http.Header{}
|
||||
err = r.SendPayload(ctx, UnAuth, func() (*Item, error) {
|
||||
return &Item{
|
||||
Method: http.MethodGet,
|
||||
|
||||
Reference in New Issue
Block a user