Skip to content

Commit

Permalink
make goimports
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor committed Dec 29, 2023
1 parent c06527e commit 0431dbb
Show file tree
Hide file tree
Showing 30 changed files with 111 additions and 68 deletions.
4 changes: 2 additions & 2 deletions flyteartifacts/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package main

import (
"context"
_ "net/http/pprof" // Required to serve application.

sharedCmd "github.com/flyteorg/flyte/flyteartifacts/cmd/shared"
"github.com/flyteorg/flyte/flyteartifacts/pkg/server"
"github.com/flyteorg/flyte/flytestdlib/contextutils"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/flyteorg/flyte/flytestdlib/promutils/labeled"
"github.com/flyteorg/flyte/flytestdlib/storage"

_ "net/http/pprof" // Required to serve application.
)

func main() {
Expand Down
4 changes: 3 additions & 1 deletion flyteartifacts/cmd/shared/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package shared

import (
"context"
"github.com/flyteorg/flyte/flytestdlib/database"

"github.com/go-gormigrate/gormigrate/v2"
"github.com/spf13/cobra"

"github.com/flyteorg/flyte/flytestdlib/database"
)

// NewMigrateCmd represents the migrate command
Expand Down
8 changes: 5 additions & 3 deletions flyteartifacts/cmd/shared/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import (
"context"
"flag"
"fmt"
"os"

"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/flyteorg/flyte/flyteartifacts/pkg/configuration"
"github.com/flyteorg/flyte/flytestdlib/config"
"github.com/flyteorg/flyte/flytestdlib/config/viper"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/flyteorg/flyte/flytestdlib/profutils"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"os"
)

var (
Expand Down
9 changes: 5 additions & 4 deletions flyteartifacts/cmd/shared/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ package shared

import (
"context"
"google.golang.org/grpc/reflection"
"net"
"net/http"

sharedCfg "github.com/flyteorg/flyte/flyteartifacts/pkg/configuration/shared"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/flyteorg/flyte/flytestdlib/promutils"
grpcMiddleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
Expand All @@ -18,6 +14,11 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"

sharedCfg "github.com/flyteorg/flyte/flyteartifacts/pkg/configuration/shared"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/flyteorg/flyte/flytestdlib/promutils"
)

func NewServeCmd(commandName string, serverCfg sharedCfg.ServerConfiguration, grpcHook GrpcRegistrationHook, httpHook HttpRegistrationHook) *cobra.Command {
Expand Down
4 changes: 3 additions & 1 deletion flyteartifacts/cmd/shared/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package shared

import (
"context"
"github.com/flyteorg/flyte/flytestdlib/promutils"

"github.com/grpc-ecosystem/grpc-gateway/runtime"
"google.golang.org/grpc"

"github.com/flyteorg/flyte/flytestdlib/promutils"
)

type GrpcRegistrationHook func(ctx context.Context, server *grpc.Server, scope promutils.Scope) error
Expand Down
4 changes: 3 additions & 1 deletion flyteartifacts/pkg/blob/artifact_blob_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package blob
import (
"context"
"fmt"

"github.com/golang/protobuf/ptypes/any"

"github.com/flyteorg/flyte/flyteartifacts/pkg/configuration"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/flyteorg/flyte/flytestdlib/promutils"
"github.com/flyteorg/flyte/flytestdlib/storage"
"github.com/golang/protobuf/ptypes/any"
)

type ArtifactBlobStore struct {
Expand Down
4 changes: 2 additions & 2 deletions flyteartifacts/pkg/configuration/config.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package configuration

import (
"time"

"github.com/flyteorg/flyte/flyteartifacts/pkg/configuration/shared"
"github.com/flyteorg/flyte/flytestdlib/config"
stdLibDb "github.com/flyteorg/flyte/flytestdlib/database"
stdLibStorage "github.com/flyteorg/flyte/flytestdlib/storage"

"time"
)

const artifactsServer = "artifactsServer"
Expand Down
1 change: 1 addition & 0 deletions flyteartifacts/pkg/configuration/shared/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package shared

import (
"fmt"

"github.com/flyteorg/flyte/flytestdlib/config"
)

Expand Down
8 changes: 5 additions & 3 deletions flyteartifacts/pkg/db/gorm_transformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package db
import (
"context"
"fmt"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/jackc/pgx/v5/pgtype"

"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/jackc/pgx/v5/pgtype"
)

func PartitionsIdlToHstore(idlPartitions *core.Partitions) pgtype.Hstore {
Expand Down
11 changes: 6 additions & 5 deletions flyteartifacts/pkg/db/querying_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import (
"context"
"database/sql"
"fmt"
"testing"

"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"
"gorm.io/driver/postgres"
"gorm.io/gorm"

"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flyte/flytestdlib/database"
"github.com/flyteorg/flyte/flytestdlib/promutils"
"github.com/stretchr/testify/assert"
"testing"

"gorm.io/driver/postgres"
"gorm.io/gorm"
)

func getMockRds(t *testing.T) (*sql.DB, sqlmock.Sqlmock, RDSStorage) {
Expand Down
10 changes: 6 additions & 4 deletions flyteartifacts/pkg/db/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import (
"context"
"errors"
"fmt"
"strconv"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"gorm.io/gorm"

"github.com/flyteorg/flyte/flyteartifacts/pkg/configuration"
"github.com/flyteorg/flyte/flyteartifacts/pkg/lib"
"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
Expand All @@ -12,10 +18,6 @@ import (
"github.com/flyteorg/flyte/flytestdlib/database"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/flyteorg/flyte/flytestdlib/promutils"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"gorm.io/gorm"
"strconv"
)

// RDSStorage should implement StorageInterface
Expand Down
10 changes: 5 additions & 5 deletions flyteartifacts/pkg/db/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ package db
import (
"context"
"fmt"
"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact"
"os"
"testing"

"github.com/flyteorg/flyte/flytestdlib/config"
"github.com/flyteorg/flyte/flytestdlib/config/viper"
"github.com/flyteorg/flyte/flytestdlib/promutils"
"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flyte/flytestdlib/config"
"github.com/flyteorg/flyte/flytestdlib/config/viper"
"github.com/flyteorg/flyte/flytestdlib/promutils"
)

func TestBasicWrite(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion flyteartifacts/pkg/lib/string_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package lib

import (
"fmt"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"strings"
"time"

"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
)

const DateFormat string = "2006-01-02"
Expand Down
8 changes: 5 additions & 3 deletions flyteartifacts/pkg/lib/string_converter_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package lib

import (
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"
"testing"
"time"

"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
)

func TestRenderDate(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions flyteartifacts/pkg/lib/url_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package lib

import (
"errors"
"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"net/url"
"regexp"
"strings"

"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
)

var flyteURLNameRe = regexp.MustCompile(`(?P<name>[\w/-]+)(?:(:(?P<tag>\w+))?)(?:(@(?P<version>\w+))?)`)
Expand Down
6 changes: 4 additions & 2 deletions flyteartifacts/pkg/lib/url_parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package lib

import (
"context"
"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
)

func TestURLParseWithTag(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions flyteartifacts/pkg/models/transformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package models
import (
"context"
"fmt"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"

"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
)

func CreateArtifactModelFromRequest(ctx context.Context, key *core.ArtifactKey, spec *artifact.ArtifactSpec, version string, partitions map[string]string, tag string, source *artifact.ArtifactSource) (Artifact, error) {
Expand Down
4 changes: 3 additions & 1 deletion flyteartifacts/pkg/server/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package server

import (
"context"

"github.com/golang/protobuf/ptypes/any"

"github.com/flyteorg/flyte/flyteartifacts/pkg/models"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
stdLibStorage "github.com/flyteorg/flyte/flytestdlib/storage"
"github.com/golang/protobuf/ptypes/any"
)

type StorageInterface interface {
Expand Down
6 changes: 4 additions & 2 deletions flyteartifacts/pkg/server/metrics.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package server

import (
"github.com/flyteorg/flyte/flytestdlib/promutils"
"github.com/prometheus/client_golang/prometheus"
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/flyteorg/flyte/flytestdlib/promutils"
)

type RequestMetrics struct {
Expand Down
8 changes: 5 additions & 3 deletions flyteartifacts/pkg/server/processor/channel_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package processor
import (
"bytes"
"context"
"time"

pbcloudevents "github.com/cloudevents/sdk-go/binding/format/protobuf/v2"
"github.com/cloudevents/sdk-go/v2/event"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"

flyteEvents "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/event"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/flyteorg/flyte/flytestdlib/sandboxutils"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
"time"
)

type SandboxCloudEventsReceiver struct {
Expand Down
5 changes: 3 additions & 2 deletions flyteartifacts/pkg/server/processor/events_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package processor
import (
"context"
"fmt"

event2 "github.com/cloudevents/sdk-go/v2/event"
"github.com/golang/protobuf/proto"

"github.com/flyteorg/flyte/flyteartifacts/pkg/lib"
"github.com/flyteorg/flyte/flyteidl/clients/go/admin"
adminPb "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact"
"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/logger"
"github.com/golang/protobuf/proto"
)

// ServiceCallHandler will take events and call the grpc endpoints directly. The service should most likely be local.
Expand Down
6 changes: 4 additions & 2 deletions flyteartifacts/pkg/server/processor/events_handler_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package processor

import (
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
)

func TestMetaDataWrite(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions flyteartifacts/pkg/server/processor/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package processor

import (
"context"

"github.com/cloudevents/sdk-go/v2/event"
"github.com/golang/protobuf/proto"
)
Expand Down
2 changes: 2 additions & 0 deletions flyteartifacts/pkg/server/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package processor

import (
"context"

"github.com/NYTimes/gizmo/pubsub"
gizmoAWS "github.com/NYTimes/gizmo/pubsub/aws"

"github.com/flyteorg/flyte/flyteartifacts/pkg/configuration"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact"
configCommon "github.com/flyteorg/flyte/flytestdlib/config"
Expand Down
Loading

0 comments on commit 0431dbb

Please sign in to comment.