From f259947922f9d02b0d6a5d4afff75f1a19c90653 Mon Sep 17 00:00:00 2001 From: Sayan Samanta Date: Tue, 31 Mar 2020 12:20:40 -0700 Subject: [PATCH] modern goreturns --- handlers/http_test.go | 11 ++++++----- limitkeys/headerlimitkey.go | 3 ++- limitkeys/headerlimitkey_test.go | 3 ++- limitkeys/limitkey.go | 1 + matchers/headermatcher.go | 3 ++- matchers/matchers.go | 1 + matchers/pathmatcher.go | 3 ++- ratelimiter/ratelimiter_test.go | 7 ++++--- 8 files changed, 20 insertions(+), 12 deletions(-) diff --git a/handlers/http_test.go b/handlers/http_test.go index 042e264..604b28c 100644 --- a/handlers/http_test.go +++ b/handlers/http_test.go @@ -3,17 +3,18 @@ package handlers import ( "errors" "fmt" - "github.com/Clever/leakybucket" - "github.com/Clever/sphinx/common" - "github.com/Clever/sphinx/limit" - "github.com/Clever/sphinx/ratelimiter" - "github.com/stretchr/testify/mock" "net/http" "net/http/httptest" "net/url" "strings" "testing" "time" + + "github.com/Clever/leakybucket" + "github.com/Clever/sphinx/common" + "github.com/Clever/sphinx/limit" + "github.com/Clever/sphinx/ratelimiter" + "github.com/stretchr/testify/mock" ) func constructMockRequestWithHeaders(headers map[string][]string) *http.Request { diff --git a/limitkeys/headerlimitkey.go b/limitkeys/headerlimitkey.go index e49275c..0c358ff 100644 --- a/limitkeys/headerlimitkey.go +++ b/limitkeys/headerlimitkey.go @@ -2,10 +2,11 @@ package limitkeys import ( "fmt" - "github.com/Clever/sphinx/common" "net/http" "sort" "strings" + + "github.com/Clever/sphinx/common" ) type headerLimitKey struct { diff --git a/limitkeys/headerlimitkey_test.go b/limitkeys/headerlimitkey_test.go index 20e0fe9..8a95dc1 100644 --- a/limitkeys/headerlimitkey_test.go +++ b/limitkeys/headerlimitkey_test.go @@ -1,8 +1,9 @@ package limitkeys import ( - "github.com/Clever/sphinx/common" "testing" + + "github.com/Clever/sphinx/common" ) func getRequest(headers map[string][]string) common.Request { diff --git a/limitkeys/limitkey.go b/limitkeys/limitkey.go index 27fc76c..89beb7f 100644 --- a/limitkeys/limitkey.go +++ b/limitkeys/limitkey.go @@ -2,6 +2,7 @@ package limitkeys import ( "fmt" + "github.com/Clever/sphinx/common" ) diff --git a/matchers/headermatcher.go b/matchers/headermatcher.go index b88d1cd..d8a3228 100644 --- a/matchers/headermatcher.go +++ b/matchers/headermatcher.go @@ -1,9 +1,10 @@ package matchers import ( - "github.com/Clever/sphinx/common" "net/http" "regexp" + + "github.com/Clever/sphinx/common" ) // type to deserialize configuration diff --git a/matchers/matchers.go b/matchers/matchers.go index a39f9a0..e59ae50 100644 --- a/matchers/matchers.go +++ b/matchers/matchers.go @@ -2,6 +2,7 @@ package matchers import ( "fmt" + "github.com/Clever/sphinx/common" ) diff --git a/matchers/pathmatcher.go b/matchers/pathmatcher.go index 2150bfd..4ebf117 100644 --- a/matchers/pathmatcher.go +++ b/matchers/pathmatcher.go @@ -1,8 +1,9 @@ package matchers import ( - "github.com/Clever/sphinx/common" "regexp" + + "github.com/Clever/sphinx/common" ) type pathMatcherConfig struct { diff --git a/ratelimiter/ratelimiter_test.go b/ratelimiter/ratelimiter_test.go index 4a10630..f677372 100644 --- a/ratelimiter/ratelimiter_test.go +++ b/ratelimiter/ratelimiter_test.go @@ -2,13 +2,14 @@ package ratelimiter import ( "fmt" + "net/http" + "testing" + "time" + "github.com/Clever/leakybucket" "github.com/Clever/sphinx/common" "github.com/Clever/sphinx/config" "github.com/Clever/sphinx/limit" - "net/http" - "testing" - "time" ) func returnLastAddStatus(rateLimiter RateLimiter, request common.Request, numAdds int) ([]Status, error) {