Skip to content

Commit

Permalink
[TT-6927] Improvement/goimports local (TykTechnologies#4329)
Browse files Browse the repository at this point in the history
* Use goimports with -local to group tyk imports together
* Import changes made by goimports -local
  • Loading branch information
titpetric authored Oct 28, 2022
1 parent c19518b commit 5814a47
Show file tree
Hide file tree
Showing 59 changed files with 132 additions and 74 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test:
# lint runs all local linters that must pass before pushing
.PHONY: lint lint-install lint-fast
lint: lint-install
goimports -w .
goimports -local github.com/TykTechnologies -w .
gofmt -w .
faillint -ignore-tests -paths "$(shell grep -v '^#' .faillint | xargs echo | sed 's/ /,/g')" ./...

Expand Down
3 changes: 2 additions & 1 deletion apidef/importer/wsdl.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"net/http"
"strings"

"github.com/TykTechnologies/tyk/apidef"
uuid "github.com/satori/go.uuid"

"github.com/TykTechnologies/tyk/apidef"
)

const WSDLSource APIImporterSource = "wsdl"
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/authentication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package oas
import (
"testing"

"github.com/TykTechnologies/tyk/apidef"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
)

func TestAuthentication(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package oas
import (
"testing"

"github.com/TykTechnologies/tyk/apidef"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
)

func TestMiddleware(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/oas.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package oas
import (
"encoding/json"

"github.com/TykTechnologies/tyk/apidef"
"github.com/getkin/kin-openapi/openapi3"

"github.com/TykTechnologies/tyk/apidef"
)

// ExtensionTykAPIGateway is the OAS schema key for the Tyk extension.
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/oas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (

"github.com/getkin/kin-openapi/openapi3"

"github.com/TykTechnologies/tyk/apidef"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
)

func TestOAS(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"net/http"
"strings"

"github.com/TykTechnologies/tyk/apidef"
"github.com/getkin/kin-openapi/openapi3"

"github.com/TykTechnologies/tyk/apidef"
)

// Operations holds Operation definitions.
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"strings"
"testing"

"github.com/TykTechnologies/tyk/apidef"
"github.com/getkin/kin-openapi/openapi3"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
)

func TestOAS_PathsAndOperations(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/security.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package oas

import (
"github.com/TykTechnologies/tyk/apidef"
"github.com/getkin/kin-openapi/openapi3"
"github.com/lonelycode/osin"

"github.com/TykTechnologies/tyk/apidef"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"sort"
"testing"

"github.com/TykTechnologies/tyk/apidef"
"github.com/getkin/kin-openapi/openapi3"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
)

func TestOAS_Security(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"testing"

"github.com/TykTechnologies/tyk/apidef"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
)

func TestServer(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion apidef/oas/upstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package oas
import (
"testing"

"github.com/TykTechnologies/tyk/apidef"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
)

func TestUpstream(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (
"strings"
"time"

"github.com/kelseyhightower/envconfig"

"github.com/TykTechnologies/tyk/apidef"
logger "github.com/TykTechnologies/tyk/log"
"github.com/TykTechnologies/tyk/regexp"
"github.com/kelseyhightower/envconfig"
)

type IPsHandleStrategy string
Expand Down
3 changes: 2 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import (
"strings"
"testing"

"github.com/TykTechnologies/tyk/apidef"
"github.com/kelseyhightower/envconfig"
"github.com/nsf/jsondiff"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
)

func TestDefaultValueAndWriteDefaultConf(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion gateway/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (
"github.com/TykTechnologies/tyk-pump/analytics"
"github.com/TykTechnologies/tyk-pump/serializer"

maxminddb "github.com/oschwald/maxminddb-golang"

"github.com/TykTechnologies/tyk/config"
"github.com/TykTechnologies/tyk/regexp"
"github.com/TykTechnologies/tyk/storage"
maxminddb "github.com/oschwald/maxminddb-golang"
)

const analyticsKeyName = "tyk-system-analytics"
Expand Down
3 changes: 2 additions & 1 deletion gateway/analytics_go_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"fmt"
"time"

"github.com/sirupsen/logrus"

"github.com/TykTechnologies/tyk-pump/analytics"
"github.com/TykTechnologies/tyk/goplugin"
"github.com/sirupsen/logrus"
)

type GoAnalyticsPlugin struct {
Expand Down
3 changes: 2 additions & 1 deletion gateway/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ import (

"github.com/TykTechnologies/tyk/config"

"github.com/TykTechnologies/tyk/apidef/oas"
uuid "github.com/satori/go.uuid"

"github.com/TykTechnologies/tyk/apidef/oas"

"github.com/gorilla/mux"
"github.com/lonelycode/osin"

Expand Down
3 changes: 2 additions & 1 deletion gateway/api_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ import (

"github.com/Masterminds/sprig/v3"

circuit "github.com/TykTechnologies/circuitbreaker"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"

circuit "github.com/TykTechnologies/circuitbreaker"

"github.com/TykTechnologies/graphql-go-tools/pkg/graphql"

"github.com/TykTechnologies/gojsonschema"
Expand Down
3 changes: 2 additions & 1 deletion gateway/api_definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ import (

"github.com/stretchr/testify/assert"

redis "github.com/go-redis/redis/v8"

"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/test"
"github.com/TykTechnologies/tyk/user"
redis "github.com/go-redis/redis/v8"
)

func TestURLRewrites(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion gateway/api_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (
"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/user"

"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/test"
"github.com/TykTechnologies/tyk/trace"
"github.com/stretchr/testify/assert"
)

func TestOpenTracing(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions gateway/auth_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"strings"
"time"

"github.com/TykTechnologies/tyk/storage"
"github.com/TykTechnologies/tyk/user"
uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"

"github.com/TykTechnologies/tyk/storage"
"github.com/TykTechnologies/tyk/user"
)

// SessionHandler handles all update/create/access session functions and deals exclusively with
Expand Down
3 changes: 2 additions & 1 deletion gateway/batch_requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (

"github.com/TykTechnologies/tyk/certs"

"github.com/valyala/fasthttp"

"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/test"
"github.com/valyala/fasthttp"
)

const testBatchRequest = `{
Expand Down
3 changes: 2 additions & 1 deletion gateway/cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/header"
"github.com/TykTechnologies/tyk/storage"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/user"

Expand Down
3 changes: 2 additions & 1 deletion gateway/coprocess_python.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (
"github.com/TykTechnologies/tyk/config"
"github.com/TykTechnologies/tyk/coprocess"

python "github.com/TykTechnologies/tyk/dlpython"
"github.com/golang/protobuf/proto"

python "github.com/TykTechnologies/tyk/dlpython"
)
import (
"os"
Expand Down
3 changes: 2 additions & 1 deletion gateway/dashboard_register_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"testing"
"time"

"github.com/TykTechnologies/tyk/config"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/config"
)

func Test_BuildDashboardConnStr(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions gateway/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ import (

"golang.org/x/net/http2/h2c"

"github.com/TykTechnologies/tyk/test"
"github.com/TykTechnologies/tyk/user"
"golang.org/x/net/http2"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
pb "google.golang.org/grpc/examples/helloworld/helloworld"

"github.com/TykTechnologies/tyk/test"
"github.com/TykTechnologies/tyk/user"
)

// For gRPC, we should be sure that HTTP/2 works with Tyk in H2C configuration also for insecure grpc over http.
Expand Down
3 changes: 2 additions & 1 deletion gateway/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (

"github.com/TykTechnologies/tyk/rpc"

"github.com/sirupsen/logrus"

"github.com/TykTechnologies/tyk/header"
"github.com/TykTechnologies/tyk/storage"
"github.com/sirupsen/logrus"
)

type (
Expand Down
3 changes: 2 additions & 1 deletion gateway/looping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"sync"
"testing"

"github.com/getkin/kin-openapi/openapi3"

"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/apidef/oas"
"github.com/getkin/kin-openapi/openapi3"

"github.com/TykTechnologies/tyk/test"
"github.com/TykTechnologies/tyk/user"
Expand Down
5 changes: 3 additions & 2 deletions gateway/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"net/http"
"testing"

cache "github.com/pmylund/go-cache"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
headers2 "github.com/TykTechnologies/tyk/header"
"github.com/TykTechnologies/tyk/test"
cache "github.com/pmylund/go-cache"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/config"
"github.com/TykTechnologies/tyk/user"
Expand Down
5 changes: 3 additions & 2 deletions gateway/mock_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"net/http"
"testing"

"github.com/TykTechnologies/tyk/apidef/oas"
"github.com/TykTechnologies/tyk/test"
"github.com/getkin/kin-openapi/openapi3"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef/oas"
"github.com/TykTechnologies/tyk/test"
)

func TestMockResponse(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions gateway/mw_external_oauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"testing"
"time"

"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/test"
"github.com/golang-jwt/jwt/v4"
"github.com/stretchr/testify/assert"

"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/test"
)

func TestExternalOAuth_JWT(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion gateway/mw_go_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"github.com/TykTechnologies/tyk-pump/analytics"
"github.com/TykTechnologies/tyk/apidef"

"github.com/sirupsen/logrus"

"github.com/TykTechnologies/tyk/ctx"
"github.com/TykTechnologies/tyk/goplugin"
"github.com/TykTechnologies/tyk/request"
"github.com/sirupsen/logrus"
)

// customResponseWriter is a wrapper around standard http.ResponseWriter
Expand Down
Loading

0 comments on commit 5814a47

Please sign in to comment.