diff --git a/flyteadmin/.golangci.yml b/flyteadmin/.golangci.yml index 3df02b549d..7135275462 100644 --- a/flyteadmin/.golangci.yml +++ b/flyteadmin/.golangci.yml @@ -10,6 +10,7 @@ linters: - deadcode - errcheck - gas + - gci - goconst - goimports - golint @@ -25,3 +26,13 @@ linters: - unparam - unused - varcheck + +linters-settings: + gci: + custom-order: true + sections: + - standard + - default + - prefix(github.com/flyteorg) + skip-generated: true + diff --git a/flyteadmin/auth/auth_context.go b/flyteadmin/auth/auth_context.go index 99eb7ef514..012fa36f41 100644 --- a/flyteadmin/auth/auth_context.go +++ b/flyteadmin/auth/auth_context.go @@ -10,15 +10,15 @@ import ( "strings" "time" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core" - "github.com/coreos/go-oidc" + "golang.org/x/oauth2" + "github.com/flyteorg/flyte/flyteadmin/auth/config" "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" + "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core" "github.com/flyteorg/flyte/flytestdlib/errors" "github.com/flyteorg/flyte/flytestdlib/logger" - "golang.org/x/oauth2" ) const ( diff --git a/flyteadmin/auth/authzserver/authorize.go b/flyteadmin/auth/authzserver/authorize.go index d0e8ecbdb0..27f145e0df 100644 --- a/flyteadmin/auth/authzserver/authorize.go +++ b/flyteadmin/auth/authzserver/authorize.go @@ -6,9 +6,9 @@ import ( "net/http" "time" - "github.com/flyteorg/flyte/flyteadmin/auth" "github.com/ory/fosite" + "github.com/flyteorg/flyte/flyteadmin/auth" "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" "github.com/flyteorg/flyte/flytestdlib/logger" ) diff --git a/flyteadmin/auth/authzserver/authorize_test.go b/flyteadmin/auth/authzserver/authorize_test.go index 08c5df2898..5377981a11 100644 --- a/flyteadmin/auth/authzserver/authorize_test.go +++ b/flyteadmin/auth/authzserver/authorize_test.go @@ -8,18 +8,14 @@ import ( "net/http/httptest" "testing" - config2 "github.com/flyteorg/flyte/flytestdlib/config" - - "github.com/flyteorg/flyte/flyteadmin/auth" + "github.com/ory/fosite" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "github.com/flyteorg/flyte/flyteadmin/auth/interfaces/mocks" - + "github.com/flyteorg/flyte/flyteadmin/auth" "github.com/flyteorg/flyte/flyteadmin/auth/config" - - "github.com/ory/fosite" - - "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteadmin/auth/interfaces/mocks" + config2 "github.com/flyteorg/flyte/flytestdlib/config" ) func TestAuthEndpoint(t *testing.T) { diff --git a/flyteadmin/auth/authzserver/initialize.go b/flyteadmin/auth/authzserver/initialize.go index 74417403ee..ef5a0d2ad4 100644 --- a/flyteadmin/auth/authzserver/initialize.go +++ b/flyteadmin/auth/authzserver/initialize.go @@ -3,14 +3,12 @@ package authzserver import ( "crypto/rsa" - "github.com/ory/fosite/handler/oauth2" - "github.com/ory/fosite" - - "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" - "github.com/ory/fosite/compose" + "github.com/ory/fosite/handler/oauth2" "github.com/ory/fosite/token/jwt" + + "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" ) // RegisterHandlers registers http endpoints for handling OAuth2 flow (/authorize, diff --git a/flyteadmin/auth/authzserver/initialize_test.go b/flyteadmin/auth/authzserver/initialize_test.go index e9dae7ba28..9f7ecb0491 100644 --- a/flyteadmin/auth/authzserver/initialize_test.go +++ b/flyteadmin/auth/authzserver/initialize_test.go @@ -3,10 +3,8 @@ package authzserver import ( "testing" - "github.com/ory/fosite/storage" - "github.com/ory/fosite/compose" - + "github.com/ory/fosite/storage" "github.com/stretchr/testify/mock" "github.com/flyteorg/flyte/flyteadmin/auth" diff --git a/flyteadmin/auth/authzserver/metadata.go b/flyteadmin/auth/authzserver/metadata.go index 043de89d87..4c701cfca8 100644 --- a/flyteadmin/auth/authzserver/metadata.go +++ b/flyteadmin/auth/authzserver/metadata.go @@ -7,14 +7,12 @@ import ( "fmt" "net/http" - "github.com/flyteorg/flyte/flyteadmin/auth" - "github.com/flyteorg/flyte/flyteadmin/auth/config" - "github.com/lestrrat-go/jwx/jwk" - "github.com/flyteorg/flyte/flytestdlib/logger" - + "github.com/flyteorg/flyte/flyteadmin/auth" + "github.com/flyteorg/flyte/flyteadmin/auth/config" "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" + "github.com/flyteorg/flyte/flytestdlib/logger" ) var ( diff --git a/flyteadmin/auth/authzserver/metadata_provider.go b/flyteadmin/auth/authzserver/metadata_provider.go index 6752ecbcee..b1887ef4c2 100644 --- a/flyteadmin/auth/authzserver/metadata_provider.go +++ b/flyteadmin/auth/authzserver/metadata_provider.go @@ -8,9 +8,7 @@ import ( "strings" "github.com/flyteorg/flyte/flyteadmin/auth" - authConfig "github.com/flyteorg/flyte/flyteadmin/auth/config" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" ) diff --git a/flyteadmin/auth/authzserver/metadata_provider_test.go b/flyteadmin/auth/authzserver/metadata_provider_test.go index 79bcc7b727..f1b244012e 100644 --- a/flyteadmin/auth/authzserver/metadata_provider_test.go +++ b/flyteadmin/auth/authzserver/metadata_provider_test.go @@ -8,12 +8,12 @@ import ( "strings" "testing" - config2 "github.com/flyteorg/flyte/flytestdlib/config" + "github.com/stretchr/testify/assert" "github.com/flyteorg/flyte/flyteadmin/auth/config" authConfig "github.com/flyteorg/flyte/flyteadmin/auth/config" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "github.com/stretchr/testify/assert" + config2 "github.com/flyteorg/flyte/flytestdlib/config" ) func TestOAuth2MetadataProvider_FlyteClient(t *testing.T) { diff --git a/flyteadmin/auth/authzserver/metadata_test.go b/flyteadmin/auth/authzserver/metadata_test.go index 8b32559a9f..8da8057974 100644 --- a/flyteadmin/auth/authzserver/metadata_test.go +++ b/flyteadmin/auth/authzserver/metadata_test.go @@ -7,12 +7,11 @@ import ( "net/http/httptest" "testing" - "github.com/flyteorg/flyte/flyteadmin/auth/interfaces/mocks" "github.com/lestrrat-go/jwx/jwk" + "github.com/stretchr/testify/assert" "github.com/flyteorg/flyte/flyteadmin/auth" - - "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteadmin/auth/interfaces/mocks" ) func Test_newJSONWebKeySet(t *testing.T) { diff --git a/flyteadmin/auth/authzserver/provider.go b/flyteadmin/auth/authzserver/provider.go index ab6a91becd..be33ac28f4 100644 --- a/flyteadmin/auth/authzserver/provider.go +++ b/flyteadmin/auth/authzserver/provider.go @@ -9,27 +9,21 @@ import ( "fmt" "time" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "github.com/flyteorg/flyte/flytestdlib/logger" - - "k8s.io/apimachinery/pkg/util/sets" - - "github.com/lestrrat-go/jwx/jwk" - - "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" - - "github.com/flyteorg/flyte/flyteadmin/auth" - "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core" - jwtgo "github.com/golang-jwt/jwt/v4" + "github.com/lestrrat-go/jwx/jwk" + "github.com/ory/fosite" + "github.com/ory/fosite/compose" fositeOAuth2 "github.com/ory/fosite/handler/oauth2" + "github.com/ory/fosite/storage" "github.com/ory/fosite/token/jwt" + "k8s.io/apimachinery/pkg/util/sets" + "github.com/flyteorg/flyte/flyteadmin/auth" "github.com/flyteorg/flyte/flyteadmin/auth/config" - - "github.com/ory/fosite" - "github.com/ory/fosite/compose" - "github.com/ory/fosite/storage" + "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" + "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core" + "github.com/flyteorg/flyte/flytestdlib/logger" ) const ( diff --git a/flyteadmin/auth/authzserver/provider_test.go b/flyteadmin/auth/authzserver/provider_test.go index b3892e7fed..4659e603a4 100644 --- a/flyteadmin/auth/authzserver/provider_test.go +++ b/flyteadmin/auth/authzserver/provider_test.go @@ -12,13 +12,11 @@ import ( "time" jwtgo "github.com/golang-jwt/jwt/v4" - - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "github.com/stretchr/testify/assert" "github.com/flyteorg/flyte/flyteadmin/auth" "github.com/flyteorg/flyte/flyteadmin/auth/config" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core/mocks" ) diff --git a/flyteadmin/auth/authzserver/resource_server.go b/flyteadmin/auth/authzserver/resource_server.go index c7db85c949..325923af1e 100644 --- a/flyteadmin/auth/authzserver/resource_server.go +++ b/flyteadmin/auth/authzserver/resource_server.go @@ -10,17 +10,15 @@ import ( "net/url" "strings" + "github.com/coreos/go-oidc" jwtgo "github.com/golang-jwt/jwt/v4" - + "golang.org/x/oauth2" "k8s.io/apimachinery/pkg/util/sets" - "github.com/flyteorg/flyte/flytestdlib/config" - - "github.com/coreos/go-oidc" authConfig "github.com/flyteorg/flyte/flyteadmin/auth/config" "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "golang.org/x/oauth2" + "github.com/flyteorg/flyte/flytestdlib/config" ) // External auth server implementation diff --git a/flyteadmin/auth/authzserver/resource_server_test.go b/flyteadmin/auth/authzserver/resource_server_test.go index b3adfab931..611ea5f4d9 100644 --- a/flyteadmin/auth/authzserver/resource_server_test.go +++ b/flyteadmin/auth/authzserver/resource_server_test.go @@ -14,13 +14,11 @@ import ( "testing" "time" + "github.com/coreos/go-oidc" "github.com/golang-jwt/jwt/v4" - - "github.com/stretchr/testify/assert" - "github.com/lestrrat-go/jwx/jwk" + "github.com/stretchr/testify/assert" - "github.com/coreos/go-oidc" "github.com/flyteorg/flyte/flyteadmin/auth/config" authConfig "github.com/flyteorg/flyte/flyteadmin/auth/config" stdlibConfig "github.com/flyteorg/flyte/flytestdlib/config" diff --git a/flyteadmin/auth/authzserver/stateless_token_store.go b/flyteadmin/auth/authzserver/stateless_token_store.go index 9b53618a80..837d9ab50a 100644 --- a/flyteadmin/auth/authzserver/stateless_token_store.go +++ b/flyteadmin/auth/authzserver/stateless_token_store.go @@ -8,17 +8,15 @@ import ( "strings" "time" - "github.com/flyteorg/flyte/flyteadmin/auth" - - "github.com/flyteorg/flyte/flyteadmin/auth/config" - "k8s.io/apimachinery/pkg/util/sets" - + "github.com/ory/fosite" "github.com/ory/fosite/handler/oauth2" oauth22 "github.com/ory/fosite/handler/oauth2" + "github.com/ory/fosite/storage" "github.com/ory/fosite/token/jwt" + "k8s.io/apimachinery/pkg/util/sets" - "github.com/ory/fosite" - "github.com/ory/fosite/storage" + "github.com/flyteorg/flyte/flyteadmin/auth" + "github.com/flyteorg/flyte/flyteadmin/auth/config" ) const ( diff --git a/flyteadmin/auth/authzserver/token.go b/flyteadmin/auth/authzserver/token.go index 9a12891ac5..c36e8cef49 100644 --- a/flyteadmin/auth/authzserver/token.go +++ b/flyteadmin/auth/authzserver/token.go @@ -7,9 +7,8 @@ import ( "github.com/ory/fosite" - "github.com/flyteorg/flyte/flytestdlib/logger" - "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" + "github.com/flyteorg/flyte/flytestdlib/logger" ) var ( diff --git a/flyteadmin/auth/authzserver/token_test.go b/flyteadmin/auth/authzserver/token_test.go index f8f5185c82..14f7ffba27 100644 --- a/flyteadmin/auth/authzserver/token_test.go +++ b/flyteadmin/auth/authzserver/token_test.go @@ -14,11 +14,9 @@ import ( "time" jwtgo "github.com/golang-jwt/jwt/v4" - - "github.com/flyteorg/flyte/flyteadmin/auth/config" - "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteadmin/auth/config" "github.com/flyteorg/flyte/flyteadmin/auth/interfaces/mocks" ) diff --git a/flyteadmin/auth/authzserver/utils.go b/flyteadmin/auth/authzserver/utils.go index 03ebbb38fd..a06501c5b5 100644 --- a/flyteadmin/auth/authzserver/utils.go +++ b/flyteadmin/auth/authzserver/utils.go @@ -5,10 +5,11 @@ import ( "encoding/base64" "net/http" - "github.com/flyteorg/flyte/flyteadmin/auth" - "github.com/flyteorg/flyte/flyteadmin/auth/config" "github.com/gtank/cryptopasta" "github.com/ory/fosite" + + "github.com/flyteorg/flyte/flyteadmin/auth" + "github.com/flyteorg/flyte/flyteadmin/auth/config" ) func interfaceSliceToStringSlice(raw []interface{}) []string { diff --git a/flyteadmin/auth/config/config_test.go b/flyteadmin/auth/config/config_test.go index 381d28d1bc..fa06506ee5 100644 --- a/flyteadmin/auth/config/config_test.go +++ b/flyteadmin/auth/config/config_test.go @@ -6,15 +6,13 @@ import ( "path/filepath" "testing" - "github.com/flyteorg/flyte/flytestdlib/logger" - - "github.com/flyteorg/flyte/flytestdlib/config" - "github.com/flyteorg/flyte/flytestdlib/config/viper" - "github.com/ghodss/yaml" + "github.com/ory/fosite" "github.com/stretchr/testify/assert" - "github.com/ory/fosite" + "github.com/flyteorg/flyte/flytestdlib/config" + "github.com/flyteorg/flyte/flytestdlib/config/viper" + "github.com/flyteorg/flyte/flytestdlib/logger" ) func TestHashFlyteClientSecret(t *testing.T) { diff --git a/flyteadmin/auth/cookie.go b/flyteadmin/auth/cookie.go index 96034642ff..bf80c1f920 100644 --- a/flyteadmin/auth/cookie.go +++ b/flyteadmin/auth/cookie.go @@ -9,11 +9,11 @@ import ( "net/url" "time" - "github.com/flyteorg/flyte/flytestdlib/errors" - "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/gorilla/securecookie" "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" + "github.com/flyteorg/flyte/flytestdlib/errors" + "github.com/flyteorg/flyte/flytestdlib/logger" ) const ( diff --git a/flyteadmin/auth/cookie_manager.go b/flyteadmin/auth/cookie_manager.go index 1ab5fbcfca..9bc64b88cf 100644 --- a/flyteadmin/auth/cookie_manager.go +++ b/flyteadmin/auth/cookie_manager.go @@ -8,12 +8,12 @@ import ( "net/http" "time" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "github.com/flyteorg/flyte/flytestdlib/errors" - "github.com/flyteorg/flyte/flytestdlib/logger" "golang.org/x/oauth2" "github.com/flyteorg/flyte/flyteadmin/auth/config" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" + "github.com/flyteorg/flyte/flytestdlib/errors" + "github.com/flyteorg/flyte/flytestdlib/logger" ) type CookieManager struct { diff --git a/flyteadmin/auth/cookie_manager_test.go b/flyteadmin/auth/cookie_manager_test.go index e36bb61671..6dd67a0473 100644 --- a/flyteadmin/auth/cookie_manager_test.go +++ b/flyteadmin/auth/cookie_manager_test.go @@ -10,13 +10,12 @@ import ( "testing" "time" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/oauth2" "github.com/flyteorg/flyte/flyteadmin/auth/config" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" ) func TestCookieManager(t *testing.T) { diff --git a/flyteadmin/auth/cookie_test.go b/flyteadmin/auth/cookie_test.go index f4cab8fd76..a5c58ad2ff 100644 --- a/flyteadmin/auth/cookie_test.go +++ b/flyteadmin/auth/cookie_test.go @@ -9,11 +9,12 @@ import ( "net/url" "testing" + "github.com/gorilla/securecookie" + "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteadmin/auth/config" "github.com/flyteorg/flyte/flyteadmin/auth/interfaces/mocks" stdConfig "github.com/flyteorg/flyte/flytestdlib/config" - "github.com/gorilla/securecookie" - "github.com/stretchr/testify/assert" ) func mustParseURL(t testing.TB, u string) url.URL { diff --git a/flyteadmin/auth/create_secrets.go b/flyteadmin/auth/create_secrets.go index 2f831571aa..26c0af8300 100644 --- a/flyteadmin/auth/create_secrets.go +++ b/flyteadmin/auth/create_secrets.go @@ -8,24 +8,21 @@ import ( "path/filepath" "strings" - "k8s.io/client-go/rest" - - "github.com/flyteorg/flyte/flytestdlib/logger" - kubeErrors "k8s.io/apimachinery/pkg/api/errors" - + "github.com/spf13/cobra" + "github.com/spf13/pflag" corev1 "k8s.io/api/core/v1" + kubeErrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" "github.com/flyteorg/flyte/flyteadmin/pkg/config" executioncluster "github.com/flyteorg/flyte/flyteadmin/pkg/executioncluster/impl" "github.com/flyteorg/flyte/flyteadmin/pkg/executioncluster/interfaces" "github.com/flyteorg/flyte/flyteadmin/pkg/runtime" "github.com/flyteorg/flyte/flytestdlib/errors" + "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/promutils" - - "github.com/spf13/cobra" - "github.com/spf13/pflag" - "k8s.io/client-go/kubernetes" ) const ( diff --git a/flyteadmin/auth/handler_utils.go b/flyteadmin/auth/handler_utils.go index 18a9d781dd..e6fd1a7236 100644 --- a/flyteadmin/auth/handler_utils.go +++ b/flyteadmin/auth/handler_utils.go @@ -5,9 +5,9 @@ import ( "net/http" "net/url" - "github.com/flyteorg/flyte/flyteadmin/auth/config" - "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" + + "github.com/flyteorg/flyte/flyteadmin/auth/config" ) const ( diff --git a/flyteadmin/auth/handler_utils_test.go b/flyteadmin/auth/handler_utils_test.go index fe5c9db135..441f83dbbb 100644 --- a/flyteadmin/auth/handler_utils_test.go +++ b/flyteadmin/auth/handler_utils_test.go @@ -3,13 +3,12 @@ package auth import ( "context" "net/http" - "testing" - config2 "github.com/flyteorg/flyte/flytestdlib/config" + "github.com/stretchr/testify/assert" "github.com/flyteorg/flyte/flyteadmin/auth/config" - "github.com/stretchr/testify/assert" + config2 "github.com/flyteorg/flyte/flytestdlib/config" ) func TestGetPublicURL(t *testing.T) { diff --git a/flyteadmin/auth/handlers.go b/flyteadmin/auth/handlers.go index a5bacdc06e..26e6428df3 100644 --- a/flyteadmin/auth/handlers.go +++ b/flyteadmin/auth/handlers.go @@ -8,9 +8,6 @@ import ( "strings" "time" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "github.com/flyteorg/flyte/flytestdlib/errors" - "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" "golang.org/x/oauth2" "google.golang.org/grpc" @@ -23,6 +20,9 @@ import ( "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" "github.com/flyteorg/flyte/flyteadmin/pkg/common" "github.com/flyteorg/flyte/flyteadmin/plugins" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" + "github.com/flyteorg/flyte/flytestdlib/errors" + "github.com/flyteorg/flyte/flytestdlib/logger" ) const ( diff --git a/flyteadmin/auth/handlers_test.go b/flyteadmin/auth/handlers_test.go index 63facc8bfa..4b4471ad7b 100644 --- a/flyteadmin/auth/handlers_test.go +++ b/flyteadmin/auth/handlers_test.go @@ -12,8 +12,6 @@ import ( "testing" "github.com/coreos/go-oidc" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - stdConfig "github.com/flyteorg/flyte/flytestdlib/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -25,6 +23,8 @@ import ( "github.com/flyteorg/flyte/flyteadmin/auth/interfaces/mocks" "github.com/flyteorg/flyte/flyteadmin/pkg/common" "github.com/flyteorg/flyte/flyteadmin/plugins" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" + stdConfig "github.com/flyteorg/flyte/flytestdlib/config" ) const ( diff --git a/flyteadmin/auth/identity_context.go b/flyteadmin/auth/identity_context.go index 4da330e101..05889f7537 100644 --- a/flyteadmin/auth/identity_context.go +++ b/flyteadmin/auth/identity_context.go @@ -5,11 +5,10 @@ import ( "fmt" "time" - "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/utils" + "k8s.io/apimachinery/pkg/util/sets" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - - "k8s.io/apimachinery/pkg/util/sets" + "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/utils" ) var ( diff --git a/flyteadmin/auth/init_secrets.go b/flyteadmin/auth/init_secrets.go index 0cccf74cc9..6e3d4a3078 100644 --- a/flyteadmin/auth/init_secrets.go +++ b/flyteadmin/auth/init_secrets.go @@ -12,11 +12,10 @@ import ( "os" "path/filepath" - "github.com/flyteorg/flyte/flyteadmin/auth/config" + "github.com/spf13/cobra" + "github.com/flyteorg/flyte/flyteadmin/auth/config" "github.com/flyteorg/flyte/flytestdlib/logger" - - "github.com/spf13/cobra" ) const ( diff --git a/flyteadmin/auth/interceptor.go b/flyteadmin/auth/interceptor.go index c347dd63c4..499d79d195 100644 --- a/flyteadmin/auth/interceptor.go +++ b/flyteadmin/auth/interceptor.go @@ -3,10 +3,11 @@ package auth import ( "context" - "github.com/flyteorg/flyte/flytestdlib/logger" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + "github.com/flyteorg/flyte/flytestdlib/logger" ) func BlanketAuthorization(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) ( diff --git a/flyteadmin/auth/interfaces/context.go b/flyteadmin/auth/interfaces/context.go index 7b73c56d21..1eff82faa7 100644 --- a/flyteadmin/auth/interfaces/context.go +++ b/flyteadmin/auth/interfaces/context.go @@ -6,18 +6,15 @@ import ( "net/url" "time" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - - "k8s.io/apimachinery/pkg/util/sets" - + "github.com/coreos/go-oidc" "github.com/lestrrat-go/jwx/jwk" - "github.com/ory/fosite" fositeOAuth2 "github.com/ory/fosite/handler/oauth2" + "golang.org/x/oauth2" + "k8s.io/apimachinery/pkg/util/sets" - "github.com/coreos/go-oidc" "github.com/flyteorg/flyte/flyteadmin/auth/config" - "golang.org/x/oauth2" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" ) //go:generate mockery -all -case=underscore diff --git a/flyteadmin/auth/interfaces/cookie.go b/flyteadmin/auth/interfaces/cookie.go index 272fab8d6a..8896e4c329 100644 --- a/flyteadmin/auth/interfaces/cookie.go +++ b/flyteadmin/auth/interfaces/cookie.go @@ -4,9 +4,9 @@ import ( "context" "net/http" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - "golang.org/x/oauth2" + + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" ) //go:generate mockery -name=CookieHandler -output=mocks/ -case=underscore diff --git a/flyteadmin/auth/token.go b/flyteadmin/auth/token.go index e864c96123..9b90a2d108 100644 --- a/flyteadmin/auth/token.go +++ b/flyteadmin/auth/token.go @@ -6,19 +6,16 @@ import ( "strings" "time" + "github.com/coreos/go-oidc" + grpcauth "github.com/grpc-ecosystem/go-grpc-middleware/auth" "github.com/grpc-ecosystem/go-grpc-middleware/util/metautils" - - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - + "golang.org/x/oauth2" "k8s.io/apimachinery/pkg/util/sets" "github.com/flyteorg/flyte/flyteadmin/auth/interfaces" - - "github.com/coreos/go-oidc" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" "github.com/flyteorg/flyte/flytestdlib/errors" "github.com/flyteorg/flyte/flytestdlib/logger" - grpcauth "github.com/grpc-ecosystem/go-grpc-middleware/auth" - "golang.org/x/oauth2" ) const ( diff --git a/flyteadmin/boilerplate/flyte/golang_support_tools/tools.go b/flyteadmin/boilerplate/flyte/golang_support_tools/tools.go index a78b61162a..6c3da04107 100644 --- a/flyteadmin/boilerplate/flyte/golang_support_tools/tools.go +++ b/flyteadmin/boilerplate/flyte/golang_support_tools/tools.go @@ -6,7 +6,8 @@ package tools import ( _ "github.com/EngHabu/mockery/cmd/mockery" _ "github.com/alvaroloes/enumer" - _ "github.com/flyteorg/flyte/flytestdlib/cli/pflags" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" _ "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" + + _ "github.com/flyteorg/flyte/flytestdlib/cli/pflags" ) diff --git a/flyteadmin/boilerplate/flyte/golang_test_targets/download_tooling.sh b/flyteadmin/boilerplate/flyte/golang_test_targets/download_tooling.sh index c7e5577ef3..9cd49959f4 100755 --- a/flyteadmin/boilerplate/flyte/golang_test_targets/download_tooling.sh +++ b/flyteadmin/boilerplate/flyte/golang_test_targets/download_tooling.sh @@ -19,6 +19,7 @@ tools=( "github.com/EngHabu/mockery/cmd/mockery" "github.com/flyteorg/flytestdlib/cli/pflags@latest" "github.com/golangci/golangci-lint/cmd/golangci-lint" + "github.com/daixiang0/gci" "github.com/alvaroloes/enumer" "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" ) diff --git a/flyteadmin/boilerplate/flyte/golang_test_targets/goimports b/flyteadmin/boilerplate/flyte/golang_test_targets/goimports index af1829036c..40f50d106e 100755 --- a/flyteadmin/boilerplate/flyte/golang_test_targets/goimports +++ b/flyteadmin/boilerplate/flyte/golang_test_targets/goimports @@ -6,3 +6,4 @@ # TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./pkg/client/*" -not -path "./boilerplate/*") +gci write -s standard -s default -s "prefix(github.com/flyteorg)" --custom-order --skip-generated . diff --git a/flyteadmin/boilerplate/flyte/golangci_file/.golangci.yml b/flyteadmin/boilerplate/flyte/golangci_file/.golangci.yml index 5d53f35295..7f4dbc80e8 100644 --- a/flyteadmin/boilerplate/flyte/golangci_file/.golangci.yml +++ b/flyteadmin/boilerplate/flyte/golangci_file/.golangci.yml @@ -13,6 +13,7 @@ linters: - deadcode - errcheck - gas + - gci - goconst - goimports - golint @@ -28,3 +29,12 @@ linters: - unparam - unused - varcheck + +linters-settings: + gci: + custom-order: true + sections: + - standard + - default + - prefix(github.com/flyteorg) + skip-generated: true diff --git a/flyteadmin/cmd/entrypoints/clusterresource.go b/flyteadmin/cmd/entrypoints/clusterresource.go index fa38491b62..bb47d8775f 100644 --- a/flyteadmin/cmd/entrypoints/clusterresource.go +++ b/flyteadmin/cmd/entrypoints/clusterresource.go @@ -4,15 +4,13 @@ import ( "context" errors2 "github.com/pkg/errors" - - "github.com/flyteorg/flyte/flytestdlib/promutils" + "github.com/spf13/cobra" + _ "gorm.io/driver/postgres" // Required to import database driver. "github.com/flyteorg/flyte/flyteadmin/pkg/clusterresource" "github.com/flyteorg/flyte/flyteadmin/pkg/runtime" "github.com/flyteorg/flyte/flytestdlib/logger" - - "github.com/spf13/cobra" - _ "gorm.io/driver/postgres" // Required to import database driver. + "github.com/flyteorg/flyte/flytestdlib/promutils" ) var parentClusterResourceCmd = &cobra.Command{ diff --git a/flyteadmin/cmd/entrypoints/k8s_secret.go b/flyteadmin/cmd/entrypoints/k8s_secret.go index 7a24f70dba..8bd14ab78e 100644 --- a/flyteadmin/cmd/entrypoints/k8s_secret.go +++ b/flyteadmin/cmd/entrypoints/k8s_secret.go @@ -1,8 +1,9 @@ package entrypoints import ( - "github.com/flyteorg/flyte/flyteadmin/auth" "github.com/spf13/cobra" + + "github.com/flyteorg/flyte/flyteadmin/auth" ) var secretsCmd = &cobra.Command{ diff --git a/flyteadmin/cmd/entrypoints/migrate.go b/flyteadmin/cmd/entrypoints/migrate.go index bb0d79788b..c7ad6058c5 100644 --- a/flyteadmin/cmd/entrypoints/migrate.go +++ b/flyteadmin/cmd/entrypoints/migrate.go @@ -3,10 +3,10 @@ package entrypoints import ( "context" - "github.com/flyteorg/flyte/flyteadmin/pkg/server" - "github.com/spf13/cobra" _ "gorm.io/driver/postgres" // Required to import database driver. + + "github.com/flyteorg/flyte/flyteadmin/pkg/server" ) var parentMigrateCmd = &cobra.Command{ diff --git a/flyteadmin/cmd/entrypoints/root.go b/flyteadmin/cmd/entrypoints/root.go index 04775b47ee..5f493d0bbc 100644 --- a/flyteadmin/cmd/entrypoints/root.go +++ b/flyteadmin/cmd/entrypoints/root.go @@ -6,14 +6,13 @@ import ( "fmt" "os" - "github.com/flyteorg/flyte/flyteadmin/plugins" - - "github.com/flyteorg/flyte/flytestdlib/logger" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "github.com/flyteorg/flyte/flyteadmin/plugins" "github.com/flyteorg/flyte/flytestdlib/config" "github.com/flyteorg/flyte/flytestdlib/config/viper" - "github.com/spf13/cobra" - "github.com/spf13/pflag" + "github.com/flyteorg/flyte/flytestdlib/logger" ) var ( diff --git a/flyteadmin/cmd/entrypoints/serve.go b/flyteadmin/cmd/entrypoints/serve.go index 56eb4483e9..680795c28f 100644 --- a/flyteadmin/cmd/entrypoints/serve.go +++ b/flyteadmin/cmd/entrypoints/serve.go @@ -2,19 +2,15 @@ package entrypoints import ( "context" - - "github.com/flyteorg/flyte/flyteadmin/plugins" - - "github.com/flyteorg/flyte/flytestdlib/profutils" - _ "net/http/pprof" // Required to serve application. - "github.com/flyteorg/flyte/flyteadmin/pkg/server" - - "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/spf13/cobra" runtimeConfig "github.com/flyteorg/flyte/flyteadmin/pkg/runtime" + "github.com/flyteorg/flyte/flyteadmin/pkg/server" + "github.com/flyteorg/flyte/flyteadmin/plugins" + "github.com/flyteorg/flyte/flytestdlib/logger" + "github.com/flyteorg/flyte/flytestdlib/profutils" ) var pluginRegistryStore = plugins.NewAtomicRegistry(plugins.NewRegistry()) diff --git a/flyteadmin/cmd/entrypoints/serve_test.go b/flyteadmin/cmd/entrypoints/serve_test.go index e2269388ad..897a56f389 100644 --- a/flyteadmin/cmd/entrypoints/serve_test.go +++ b/flyteadmin/cmd/entrypoints/serve_test.go @@ -10,13 +10,14 @@ import ( "fmt" "testing" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" "github.com/stretchr/testify/assert" "golang.org/x/oauth2" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/oauth" + + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" ) func TestClient(t *testing.T) { diff --git a/flyteadmin/cmd/main.go b/flyteadmin/cmd/main.go index d64c8a5dbf..26b79007c8 100644 --- a/flyteadmin/cmd/main.go +++ b/flyteadmin/cmd/main.go @@ -1,9 +1,10 @@ package main import ( + "github.com/golang/glog" + "github.com/flyteorg/flyte/flyteadmin/cmd/entrypoints" "github.com/flyteorg/flyte/flyteadmin/plugins" - "github.com/golang/glog" ) func main() { diff --git a/flyteadmin/cmd/scheduler/entrypoints/precheck.go b/flyteadmin/cmd/scheduler/entrypoints/precheck.go index a3e3e8add5..c183429969 100644 --- a/flyteadmin/cmd/scheduler/entrypoints/precheck.go +++ b/flyteadmin/cmd/scheduler/entrypoints/precheck.go @@ -4,11 +4,11 @@ import ( "context" "fmt" - "github.com/flyteorg/flyte/flyteidl/clients/go/admin" - "github.com/flyteorg/flyte/flytestdlib/logger" - "github.com/spf13/cobra" "google.golang.org/grpc/health/grpc_health_v1" + + "github.com/flyteorg/flyte/flyteidl/clients/go/admin" + "github.com/flyteorg/flyte/flytestdlib/logger" ) const ( diff --git a/flyteadmin/cmd/scheduler/entrypoints/root.go b/flyteadmin/cmd/scheduler/entrypoints/root.go index 1f37a11df9..dd50b03b19 100644 --- a/flyteadmin/cmd/scheduler/entrypoints/root.go +++ b/flyteadmin/cmd/scheduler/entrypoints/root.go @@ -6,12 +6,12 @@ import ( "fmt" "os" - "github.com/flyteorg/flyte/flytestdlib/logger" + "github.com/spf13/cobra" + "github.com/spf13/pflag" "github.com/flyteorg/flyte/flytestdlib/config" "github.com/flyteorg/flyte/flytestdlib/config/viper" - "github.com/spf13/cobra" - "github.com/spf13/pflag" + "github.com/flyteorg/flyte/flytestdlib/logger" ) var ( diff --git a/flyteadmin/cmd/scheduler/entrypoints/scheduler.go b/flyteadmin/cmd/scheduler/entrypoints/scheduler.go index 15935bcb04..a541444f19 100644 --- a/flyteadmin/cmd/scheduler/entrypoints/scheduler.go +++ b/flyteadmin/cmd/scheduler/entrypoints/scheduler.go @@ -3,14 +3,14 @@ package entrypoints import ( "context" - "github.com/flyteorg/flyte/flyteadmin/pkg/server" + "github.com/spf13/cobra" + _ "gorm.io/driver/postgres" // Required to import database driver. "github.com/flyteorg/flyte/flyteadmin/pkg/runtime" + "github.com/flyteorg/flyte/flyteadmin/pkg/server" "github.com/flyteorg/flyte/flyteadmin/scheduler" "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/profutils" - "github.com/spf13/cobra" - _ "gorm.io/driver/postgres" // Required to import database driver. ) var schedulerRunCmd = &cobra.Command{ diff --git a/flyteadmin/cmd/scheduler/main.go b/flyteadmin/cmd/scheduler/main.go index 9b12d85116..260afede08 100644 --- a/flyteadmin/cmd/scheduler/main.go +++ b/flyteadmin/cmd/scheduler/main.go @@ -1,8 +1,9 @@ package main import ( - "github.com/flyteorg/flyte/flyteadmin/cmd/scheduler/entrypoints" "github.com/golang/glog" + + "github.com/flyteorg/flyte/flyteadmin/cmd/scheduler/entrypoints" ) func main() { diff --git a/flyteadmin/dataproxy/service.go b/flyteadmin/dataproxy/service.go index 049bd14b1e..07c8ae1196 100644 --- a/flyteadmin/dataproxy/service.go +++ b/flyteadmin/dataproxy/service.go @@ -12,30 +12,22 @@ import ( "strings" "time" - "github.com/flyteorg/flyte/flyteadmin/pkg/common" - - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" - "github.com/flyteorg/flyte/flytestdlib/logger" - - "github.com/flyteorg/flyte/flyteadmin/pkg/errors" "google.golang.org/grpc/codes" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/timestamppb" + "k8s.io/apimachinery/pkg/util/rand" + "github.com/flyteorg/flyte/flyteadmin/pkg/common" + "github.com/flyteorg/flyte/flyteadmin/pkg/config" + "github.com/flyteorg/flyte/flyteadmin/pkg/errors" "github.com/flyteorg/flyte/flyteadmin/pkg/manager/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" - + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" "github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/ioutils" - - "google.golang.org/protobuf/types/known/durationpb" - - "github.com/flyteorg/flyte/flyteadmin/pkg/config" - - "google.golang.org/protobuf/types/known/timestamppb" - + "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/storage" "github.com/flyteorg/stow" - "k8s.io/apimachinery/pkg/util/rand" - - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" ) type Service struct { diff --git a/flyteadmin/dataproxy/service_test.go b/flyteadmin/dataproxy/service_test.go index 814ac38ecd..3716b98914 100644 --- a/flyteadmin/dataproxy/service_test.go +++ b/flyteadmin/dataproxy/service_test.go @@ -8,27 +8,22 @@ import ( "testing" "time" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/golang/protobuf/proto" - - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" - - "github.com/flyteorg/flyte/flyteadmin/pkg/manager/mocks" + "github.com/stretchr/testify/assert" + "google.golang.org/protobuf/types/known/durationpb" commonMocks "github.com/flyteorg/flyte/flyteadmin/pkg/common/mocks" - stdlibConfig "github.com/flyteorg/flyte/flytestdlib/config" - + "github.com/flyteorg/flyte/flyteadmin/pkg/config" "github.com/flyteorg/flyte/flyteadmin/pkg/errors" - "github.com/flyteorg/flyte/flytestdlib/contextutils" - "github.com/flyteorg/flyte/flytestdlib/promutils/labeled" - "google.golang.org/protobuf/types/known/durationpb" - + "github.com/flyteorg/flyte/flyteadmin/pkg/manager/mocks" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service" - - "github.com/flyteorg/flyte/flyteadmin/pkg/config" + stdlibConfig "github.com/flyteorg/flyte/flytestdlib/config" + "github.com/flyteorg/flyte/flytestdlib/contextutils" "github.com/flyteorg/flyte/flytestdlib/promutils" + "github.com/flyteorg/flyte/flytestdlib/promutils/labeled" "github.com/flyteorg/flyte/flytestdlib/storage" - "github.com/stretchr/testify/assert" ) func TestNewService(t *testing.T) { diff --git a/flyteadmin/pkg/async/cloudevent/factory.go b/flyteadmin/pkg/async/cloudevent/factory.go index 976aa34532..efa0848ccb 100644 --- a/flyteadmin/pkg/async/cloudevent/factory.go +++ b/flyteadmin/pkg/async/cloudevent/factory.go @@ -10,6 +10,7 @@ import ( "github.com/Shopify/sarama" "github.com/cloudevents/sdk-go/protocol/kafka_sarama/v2" cloudevents "github.com/cloudevents/sdk-go/v2" + "github.com/flyteorg/flyte/flyteadmin/pkg/async" cloudEventImplementations "github.com/flyteorg/flyte/flyteadmin/pkg/async/cloudevent/implementations" "github.com/flyteorg/flyte/flyteadmin/pkg/async/cloudevent/interfaces" diff --git a/flyteadmin/pkg/async/cloudevent/factory_test.go b/flyteadmin/pkg/async/cloudevent/factory_test.go index e5ccdbee22..6d6c1a881c 100644 --- a/flyteadmin/pkg/async/cloudevent/factory_test.go +++ b/flyteadmin/pkg/async/cloudevent/factory_test.go @@ -4,11 +4,12 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/cloudevent/implementations" "github.com/flyteorg/flyte/flyteadmin/pkg/common" runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/stretchr/testify/assert" ) func TestGetCloudEventPublisher(t *testing.T) { diff --git a/flyteadmin/pkg/async/cloudevent/implementations/cloudevent_publisher.go b/flyteadmin/pkg/async/cloudevent/implementations/cloudevent_publisher.go index 8eafefffc0..925e7ef18f 100644 --- a/flyteadmin/pkg/async/cloudevent/implementations/cloudevent_publisher.go +++ b/flyteadmin/pkg/async/cloudevent/implementations/cloudevent_publisher.go @@ -7,21 +7,16 @@ import ( "reflect" "time" - "github.com/golang/protobuf/jsonpb" - - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" - - "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/implementations" - cloudevents "github.com/cloudevents/sdk-go/v2" - + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" "k8s.io/apimachinery/pkg/util/sets" "github.com/flyteorg/flyte/flyteadmin/pkg/async/cloudevent/interfaces" - + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/implementations" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/golang/protobuf/proto" ) const ( diff --git a/flyteadmin/pkg/async/cloudevent/implementations/cloudevent_publisher_test.go b/flyteadmin/pkg/async/cloudevent/implementations/cloudevent_publisher_test.go index 65bedaac47..d9108aa3ff 100644 --- a/flyteadmin/pkg/async/cloudevent/implementations/cloudevent_publisher_test.go +++ b/flyteadmin/pkg/async/cloudevent/implementations/cloudevent_publisher_test.go @@ -7,20 +7,19 @@ import ( "testing" "time" - "github.com/golang/protobuf/jsonpb" - - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/event" - "github.com/golang/protobuf/ptypes" - "github.com/NYTimes/gizmo/pubsub" "github.com/NYTimes/gizmo/pubsub/pubsubtest" pbcloudevents "github.com/cloudevents/sdk-go/binding/format/protobuf/v2" cloudevents "github.com/cloudevents/sdk-go/v2" - "github.com/flyteorg/flyte/flytestdlib/promutils" + "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" "github.com/stretchr/testify/assert" + + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/event" + "github.com/flyteorg/flyte/flytestdlib/promutils" ) type mockKafkaSender struct{} diff --git a/flyteadmin/pkg/async/cloudevent/implementations/sender.go b/flyteadmin/pkg/async/cloudevent/implementations/sender.go index 263e4cfd56..4e7ba23d8a 100644 --- a/flyteadmin/pkg/async/cloudevent/implementations/sender.go +++ b/flyteadmin/pkg/async/cloudevent/implementations/sender.go @@ -9,6 +9,7 @@ import ( pbcloudevents "github.com/cloudevents/sdk-go/binding/format/protobuf/v2" "github.com/cloudevents/sdk-go/protocol/kafka_sarama/v2" cloudevents "github.com/cloudevents/sdk-go/v2" + "github.com/flyteorg/flyte/flytestdlib/logger" ) diff --git a/flyteadmin/pkg/async/cloudevent/implementations/sender_test.go b/flyteadmin/pkg/async/cloudevent/implementations/sender_test.go index 93c05829f1..684eb36c56 100644 --- a/flyteadmin/pkg/async/cloudevent/implementations/sender_test.go +++ b/flyteadmin/pkg/async/cloudevent/implementations/sender_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/NYTimes/gizmo/pubsub/pubsubtest" - cloudevents "github.com/cloudevents/sdk-go/v2" "github.com/cloudevents/sdk-go/v2/event" "github.com/cloudevents/sdk-go/v2/protocol" diff --git a/flyteadmin/pkg/async/events/implementations/node_execution_event_writer.go b/flyteadmin/pkg/async/events/implementations/node_execution_event_writer.go index fbcc50aa83..623baf354d 100644 --- a/flyteadmin/pkg/async/events/implementations/node_execution_event_writer.go +++ b/flyteadmin/pkg/async/events/implementations/node_execution_event_writer.go @@ -3,9 +3,8 @@ package implementations import ( "context" - repositoryInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/repositories/interfaces" - "github.com/flyteorg/flyte/flyteadmin/pkg/async/events/interfaces" + repositoryInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/repositories/interfaces" "github.com/flyteorg/flyte/flyteadmin/pkg/repositories/transformers" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" diff --git a/flyteadmin/pkg/async/events/implementations/workflow_execution_event_writer.go b/flyteadmin/pkg/async/events/implementations/workflow_execution_event_writer.go index 6d326d4708..7521dee4b8 100644 --- a/flyteadmin/pkg/async/events/implementations/workflow_execution_event_writer.go +++ b/flyteadmin/pkg/async/events/implementations/workflow_execution_event_writer.go @@ -3,9 +3,8 @@ package implementations import ( "context" - repositoryInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/repositories/interfaces" - "github.com/flyteorg/flyte/flyteadmin/pkg/async/events/interfaces" + repositoryInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/repositories/interfaces" "github.com/flyteorg/flyte/flyteadmin/pkg/repositories/transformers" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" diff --git a/flyteadmin/pkg/async/notifications/email.go b/flyteadmin/pkg/async/notifications/email.go index 6481d0cc20..94eb71719c 100644 --- a/flyteadmin/pkg/async/notifications/email.go +++ b/flyteadmin/pkg/async/notifications/email.go @@ -2,7 +2,6 @@ package notifications import ( "fmt" - "strings" runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" diff --git a/flyteadmin/pkg/async/notifications/email_test.go b/flyteadmin/pkg/async/notifications/email_test.go index 53fcb585c1..f05f893124 100644 --- a/flyteadmin/pkg/async/notifications/email_test.go +++ b/flyteadmin/pkg/async/notifications/email_test.go @@ -2,16 +2,16 @@ package notifications import ( "fmt" + "strings" "testing" - "strings" + "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/assert" runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/event" - "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/assert" ) const executionProjectValue = "proj" diff --git a/flyteadmin/pkg/async/notifications/factory.go b/flyteadmin/pkg/async/notifications/factory.go index 54496376dd..53e96f7e67 100644 --- a/flyteadmin/pkg/async/notifications/factory.go +++ b/flyteadmin/pkg/async/notifications/factory.go @@ -6,13 +6,6 @@ import ( "sync" "time" - "github.com/flyteorg/flyte/flyteadmin/pkg/async" - - "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/implementations" - "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" - runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" - "github.com/flyteorg/flyte/flytestdlib/logger" - "github.com/NYTimes/gizmo/pubsub" gizmoAWS "github.com/NYTimes/gizmo/pubsub/aws" gizmoGCP "github.com/NYTimes/gizmo/pubsub/gcp" @@ -20,7 +13,12 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ses" + "github.com/flyteorg/flyte/flyteadmin/pkg/async" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/implementations" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" "github.com/flyteorg/flyte/flyteadmin/pkg/common" + runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" + "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/promutils" ) diff --git a/flyteadmin/pkg/async/notifications/factory_test.go b/flyteadmin/pkg/async/notifications/factory_test.go index f52989d386..1bfd1f4596 100644 --- a/flyteadmin/pkg/async/notifications/factory_test.go +++ b/flyteadmin/pkg/async/notifications/factory_test.go @@ -4,11 +4,12 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/implementations" runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/stretchr/testify/assert" ) var ( diff --git a/flyteadmin/pkg/async/notifications/implementations/aws_emailer.go b/flyteadmin/pkg/async/notifications/implementations/aws_emailer.go index 94f96a1c57..72985c9548 100644 --- a/flyteadmin/pkg/async/notifications/implementations/aws_emailer.go +++ b/flyteadmin/pkg/async/notifications/implementations/aws_emailer.go @@ -5,13 +5,14 @@ import ( "github.com/aws/aws-sdk-go/service/ses" "github.com/aws/aws-sdk-go/service/ses/sesiface" + "google.golang.org/grpc/codes" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" "github.com/flyteorg/flyte/flyteadmin/pkg/errors" runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/promutils" - "google.golang.org/grpc/codes" ) type AwsEmailer struct { diff --git a/flyteadmin/pkg/async/notifications/implementations/aws_emailer_test.go b/flyteadmin/pkg/async/notifications/implementations/aws_emailer_test.go index aa8e1585b3..c06d818eec 100644 --- a/flyteadmin/pkg/async/notifications/implementations/aws_emailer_test.go +++ b/flyteadmin/pkg/async/notifications/implementations/aws_emailer_test.go @@ -1,19 +1,19 @@ package implementations import ( - "testing" - "context" + "testing" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ses" "github.com/aws/aws-sdk-go/service/ses/sesiface" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/mocks" runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/pkg/errors" - "github.com/stretchr/testify/assert" ) func getNotificationsConfig() runtimeInterfaces.NotificationsConfig { diff --git a/flyteadmin/pkg/async/notifications/implementations/aws_processor.go b/flyteadmin/pkg/async/notifications/implementations/aws_processor.go index fe99ad0af9..fb3b3c2a1b 100644 --- a/flyteadmin/pkg/async/notifications/implementations/aws_processor.go +++ b/flyteadmin/pkg/async/notifications/implementations/aws_processor.go @@ -7,12 +7,13 @@ import ( "time" "github.com/NYTimes/gizmo/pubsub" + "github.com/golang/protobuf/proto" + "github.com/flyteorg/flyte/flyteadmin/pkg/async" "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/golang/protobuf/proto" ) // TODO: Add a counter that encompasses the publisher stats grouped by project and domain. diff --git a/flyteadmin/pkg/async/notifications/implementations/aws_processor_test.go b/flyteadmin/pkg/async/notifications/implementations/aws_processor_test.go index f189ec1cb8..ef27f1f3a8 100644 --- a/flyteadmin/pkg/async/notifications/implementations/aws_processor_test.go +++ b/flyteadmin/pkg/async/notifications/implementations/aws_processor_test.go @@ -2,16 +2,15 @@ package implementations import ( "context" + "encoding/base64" "errors" "testing" - "encoding/base64" - "github.com/aws/aws-sdk-go/aws" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" + "github.com/stretchr/testify/assert" "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/mocks" - "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" ) var mockEmailer mocks.MockEmailer diff --git a/flyteadmin/pkg/async/notifications/implementations/email_metrics.go b/flyteadmin/pkg/async/notifications/implementations/email_metrics.go index 00195b3d26..3607cee286 100644 --- a/flyteadmin/pkg/async/notifications/implementations/email_metrics.go +++ b/flyteadmin/pkg/async/notifications/implementations/email_metrics.go @@ -1,8 +1,9 @@ package implementations import ( - "github.com/flyteorg/flyte/flytestdlib/promutils" "github.com/prometheus/client_golang/prometheus" + + "github.com/flyteorg/flyte/flytestdlib/promutils" ) type emailMetrics struct { diff --git a/flyteadmin/pkg/async/notifications/implementations/event_publisher.go b/flyteadmin/pkg/async/notifications/implementations/event_publisher.go index fc501ff12f..d91f54de33 100644 --- a/flyteadmin/pkg/async/notifications/implementations/event_publisher.go +++ b/flyteadmin/pkg/async/notifications/implementations/event_publisher.go @@ -3,17 +3,15 @@ package implementations import ( "context" + "github.com/NYTimes/gizmo/pubsub" + "github.com/golang/protobuf/proto" + "github.com/prometheus/client_golang/prometheus" "k8s.io/apimachinery/pkg/util/sets" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" - "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" - - "github.com/NYTimes/gizmo/pubsub" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/golang/protobuf/proto" - "github.com/prometheus/client_golang/prometheus" ) type EventPublisherSystemMetrics struct { diff --git a/flyteadmin/pkg/async/notifications/implementations/event_publisher_test.go b/flyteadmin/pkg/async/notifications/implementations/event_publisher_test.go index c6223bbf61..804e2fadae 100644 --- a/flyteadmin/pkg/async/notifications/implementations/event_publisher_test.go +++ b/flyteadmin/pkg/async/notifications/implementations/event_publisher_test.go @@ -6,16 +6,16 @@ import ( "testing" "time" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/event" - "github.com/golang/protobuf/ptypes" - "github.com/NYTimes/gizmo/pubsub" "github.com/NYTimes/gizmo/pubsub/pubsubtest" - "github.com/flyteorg/flyte/flytestdlib/promutils" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" "github.com/stretchr/testify/assert" + + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/event" + "github.com/flyteorg/flyte/flytestdlib/promutils" ) var testEventPublisher pubsubtest.TestPublisher diff --git a/flyteadmin/pkg/async/notifications/implementations/gcp_processor.go b/flyteadmin/pkg/async/notifications/implementations/gcp_processor.go index 2127f02cf1..54e4f4a592 100644 --- a/flyteadmin/pkg/async/notifications/implementations/gcp_processor.go +++ b/flyteadmin/pkg/async/notifications/implementations/gcp_processor.go @@ -5,12 +5,13 @@ import ( "time" "github.com/NYTimes/gizmo/pubsub" + "github.com/golang/protobuf/proto" + "github.com/flyteorg/flyte/flyteadmin/pkg/async" "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/golang/protobuf/proto" ) // TODO: Add a counter that encompasses the publisher stats grouped by project and domain. diff --git a/flyteadmin/pkg/async/notifications/implementations/gcp_processor_test.go b/flyteadmin/pkg/async/notifications/implementations/gcp_processor_test.go index 35ab94c093..e83cf7b1d3 100644 --- a/flyteadmin/pkg/async/notifications/implementations/gcp_processor_test.go +++ b/flyteadmin/pkg/async/notifications/implementations/gcp_processor_test.go @@ -5,12 +5,13 @@ import ( "testing" "github.com/NYTimes/gizmo/pubsub/pubsubtest" - "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/mocks" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" - "github.com/flyteorg/flyte/flytestdlib/promutils" "github.com/pkg/errors" dto "github.com/prometheus/client_model/go" "github.com/stretchr/testify/assert" + + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/mocks" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" + "github.com/flyteorg/flyte/flytestdlib/promutils" ) var ( diff --git a/flyteadmin/pkg/async/notifications/implementations/noop_notifications.go b/flyteadmin/pkg/async/notifications/implementations/noop_notifications.go index ca716113ae..4da316f6b2 100644 --- a/flyteadmin/pkg/async/notifications/implementations/noop_notifications.go +++ b/flyteadmin/pkg/async/notifications/implementations/noop_notifications.go @@ -2,15 +2,13 @@ package implementations import ( "context" + "strings" - "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" + "github.com/golang/protobuf/proto" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" - - "strings" - - "github.com/golang/protobuf/proto" ) // Email to use when there is no email configuration. diff --git a/flyteadmin/pkg/async/notifications/implementations/processor_metrics.go b/flyteadmin/pkg/async/notifications/implementations/processor_metrics.go index 938ce2b325..de62632fe4 100644 --- a/flyteadmin/pkg/async/notifications/implementations/processor_metrics.go +++ b/flyteadmin/pkg/async/notifications/implementations/processor_metrics.go @@ -1,8 +1,9 @@ package implementations import ( - "github.com/flyteorg/flyte/flytestdlib/promutils" "github.com/prometheus/client_golang/prometheus" + + "github.com/flyteorg/flyte/flytestdlib/promutils" ) type processorSystemMetrics struct { diff --git a/flyteadmin/pkg/async/notifications/implementations/publisher.go b/flyteadmin/pkg/async/notifications/implementations/publisher.go index d168e51083..8d0d99411b 100644 --- a/flyteadmin/pkg/async/notifications/implementations/publisher.go +++ b/flyteadmin/pkg/async/notifications/implementations/publisher.go @@ -3,13 +3,13 @@ package implementations import ( "context" - "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" - "github.com/NYTimes/gizmo/pubsub" - "github.com/flyteorg/flyte/flytestdlib/logger" - "github.com/flyteorg/flyte/flytestdlib/promutils" "github.com/golang/protobuf/proto" "github.com/prometheus/client_golang/prometheus" + + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" + "github.com/flyteorg/flyte/flytestdlib/logger" + "github.com/flyteorg/flyte/flytestdlib/promutils" ) type publisherSystemMetrics struct { diff --git a/flyteadmin/pkg/async/notifications/implementations/publisher_test.go b/flyteadmin/pkg/async/notifications/implementations/publisher_test.go index e55df967fb..bde4aae325 100644 --- a/flyteadmin/pkg/async/notifications/implementations/publisher_test.go +++ b/flyteadmin/pkg/async/notifications/implementations/publisher_test.go @@ -9,11 +9,12 @@ import ( "github.com/NYTimes/gizmo/pubsub" "github.com/NYTimes/gizmo/pubsub/pubsubtest" "github.com/aws/aws-sdk-go/aws" + "github.com/golang/protobuf/proto" + "github.com/stretchr/testify/assert" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/mocks" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/golang/protobuf/proto" - "github.com/stretchr/testify/assert" ) var ( diff --git a/flyteadmin/pkg/async/notifications/implementations/sandbox_processor.go b/flyteadmin/pkg/async/notifications/implementations/sandbox_processor.go index 128b865e84..2cb83da406 100644 --- a/flyteadmin/pkg/async/notifications/implementations/sandbox_processor.go +++ b/flyteadmin/pkg/async/notifications/implementations/sandbox_processor.go @@ -4,11 +4,12 @@ import ( "context" "time" + "github.com/golang/protobuf/proto" + "github.com/flyteorg/flyte/flyteadmin/pkg/async" "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/logger" - "github.com/golang/protobuf/proto" ) type SandboxProcessor struct { diff --git a/flyteadmin/pkg/async/notifications/implementations/sandbox_processor_test.go b/flyteadmin/pkg/async/notifications/implementations/sandbox_processor_test.go index 1a703faf70..d0ee9ee31b 100644 --- a/flyteadmin/pkg/async/notifications/implementations/sandbox_processor_test.go +++ b/flyteadmin/pkg/async/notifications/implementations/sandbox_processor_test.go @@ -5,10 +5,11 @@ import ( "testing" "time" - "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/mocks" - "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/pkg/errors" "github.com/stretchr/testify/assert" + + "github.com/flyteorg/flyte/flyteadmin/pkg/async/notifications/mocks" + "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" ) var mockSandboxEmailer mocks.MockEmailer diff --git a/flyteadmin/pkg/async/notifications/implementations/sandbox_publisher.go b/flyteadmin/pkg/async/notifications/implementations/sandbox_publisher.go index c023d429bb..a0114a95eb 100644 --- a/flyteadmin/pkg/async/notifications/implementations/sandbox_publisher.go +++ b/flyteadmin/pkg/async/notifications/implementations/sandbox_publisher.go @@ -3,8 +3,9 @@ package implementations import ( "context" - "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/golang/protobuf/proto" + + "github.com/flyteorg/flyte/flytestdlib/logger" ) type SandboxPublisher struct { diff --git a/flyteadmin/pkg/async/notifications/implementations/sendgrid_emailer_test.go b/flyteadmin/pkg/async/notifications/implementations/sendgrid_emailer_test.go index fd16c9cf15..bfedb152d0 100644 --- a/flyteadmin/pkg/async/notifications/implementations/sendgrid_emailer_test.go +++ b/flyteadmin/pkg/async/notifications/implementations/sendgrid_emailer_test.go @@ -6,10 +6,11 @@ import ( "path" "testing" + "github.com/stretchr/testify/assert" + runtimeInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flytestdlib/promutils" - "github.com/stretchr/testify/assert" ) func TestAddresses(t *testing.T) { diff --git a/flyteadmin/pkg/async/schedule/aws/cloud_watch_scheduler.go b/flyteadmin/pkg/async/schedule/aws/cloud_watch_scheduler.go index 26bfec0631..768d195766 100644 --- a/flyteadmin/pkg/async/schedule/aws/cloud_watch_scheduler.go +++ b/flyteadmin/pkg/async/schedule/aws/cloud_watch_scheduler.go @@ -5,6 +5,13 @@ import ( "fmt" "strings" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/cloudwatchevents" + "github.com/prometheus/client_golang/prometheus" + "google.golang.org/grpc/codes" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/schedule/aws/interfaces" scheduleInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/async/schedule/interfaces" "github.com/flyteorg/flyte/flyteadmin/pkg/errors" @@ -13,13 +20,6 @@ import ( "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/flyteorg/flyte/flytestdlib/promutils" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/cloudwatchevents" - "github.com/prometheus/client_golang/prometheus" - "google.golang.org/grpc/codes" ) // To indicate that a schedule rule is enabled. diff --git a/flyteadmin/pkg/async/schedule/aws/cloud_watch_scheduler_test.go b/flyteadmin/pkg/async/schedule/aws/cloud_watch_scheduler_test.go index 86b08df5b0..bb32163d1f 100644 --- a/flyteadmin/pkg/async/schedule/aws/cloud_watch_scheduler_test.go +++ b/flyteadmin/pkg/async/schedule/aws/cloud_watch_scheduler_test.go @@ -5,6 +5,11 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/cloudwatchevents" + "github.com/stretchr/testify/assert" + "google.golang.org/grpc/codes" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/schedule/aws/interfaces" "github.com/flyteorg/flyte/flyteadmin/pkg/async/schedule/aws/mocks" scheduleInterfaces "github.com/flyteorg/flyte/flyteadmin/pkg/async/schedule/interfaces" @@ -12,11 +17,6 @@ import ( "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flyte/flytestdlib/promutils" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/service/cloudwatchevents" - "github.com/stretchr/testify/assert" - "google.golang.org/grpc/codes" ) const testScheduleName = "flyte_16301494360130577061" diff --git a/flyteadmin/pkg/async/schedule/aws/mocks/mock_cloud_watch_event_client.go b/flyteadmin/pkg/async/schedule/aws/mocks/mock_cloud_watch_event_client.go index c7bdb4c0fc..91bda97bbe 100644 --- a/flyteadmin/pkg/async/schedule/aws/mocks/mock_cloud_watch_event_client.go +++ b/flyteadmin/pkg/async/schedule/aws/mocks/mock_cloud_watch_event_client.go @@ -2,6 +2,7 @@ package mocks import ( "github.com/aws/aws-sdk-go/service/cloudwatchevents" + "github.com/flyteorg/flyte/flyteadmin/pkg/async/schedule/aws/interfaces" ) diff --git a/flyteadmin/pkg/async/schedule/aws/serialization.go b/flyteadmin/pkg/async/schedule/aws/serialization.go index e10f3f89d8..833235f4fc 100644 --- a/flyteadmin/pkg/async/schedule/aws/serialization.go +++ b/flyteadmin/pkg/async/schedule/aws/serialization.go @@ -8,12 +8,12 @@ import ( "fmt" "time" - "github.com/flyteorg/flyte/flytestdlib/logger" + "github.com/golang/protobuf/proto" + "google.golang.org/grpc/codes" "github.com/flyteorg/flyte/flyteadmin/pkg/errors" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" - "github.com/golang/protobuf/proto" - "google.golang.org/grpc/codes" + "github.com/flyteorg/flyte/flytestdlib/logger" ) const awsTimestampPlaceholder = "