Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lint-fix make target, add gci to flytectl, remove goimports make target #5484

Merged
merged 4 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions boilerplate/flyte/golang_test_targets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ generate: download_tooling #generate go code
lint: download_tooling #lints the package for common code smells
GL_DEBUG=linters_output,env golangci-lint run --deadline=5m --exclude deprecated -v

# If code is failing goimports linter, this will fix.
# skips 'vendor'
.PHONY: goimports
goimports:
@boilerplate/flyte/golang_test_targets/goimports
.PHONY: lint-fix
lint-fix: download_tooling #lint the package for common code smells. fixes files in-place
GL_DEBUG=linters_output,env golangci-lint run --fix --deadline=5m --exclude deprecated -v
Sovietaced marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: mod_download
mod_download: #download dependencies (including test deps) for the package
Expand Down
2 changes: 2 additions & 0 deletions boilerplate/flyte/golang_test_targets/Readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Provides an ``install`` make target that uses ``go mod`` to install golang depen

Provides a ``lint`` make target that uses golangci to lint your code.

Provides a ``lint-fix`` make target that uses golangci to lint and fix your code in place.

Provides a ``test_unit`` target for unit tests.

Provides a ``test_unit_cover`` target for analysing coverage of unit tests, which will output the coverage of each function and total statement coverage.
Expand Down
9 changes: 0 additions & 9 deletions boilerplate/flyte/golang_test_targets/goimports

This file was deleted.

1 change: 1 addition & 0 deletions flytectl/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ linters:
- deadcode
- errcheck
- gas
- gci
- goconst
- goimports
- golint
Expand Down
3 changes: 1 addition & 2 deletions flytectl/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"fmt"
"strings"

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

"github.com/flyteorg/flyte/flytectl/pkg/printer"
"github.com/flyteorg/flyte/flytestdlib/config"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

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

"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

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

"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

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

"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

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

"github.com/stretchr/testify/assert"
)

Expand Down
1 change: 0 additions & 1 deletion flytectl/cmd/config/subcommand/project/project_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/pkg/filters"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"gopkg.in/yaml.v3"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/flyteorg/flyte/flytectl/clierrors"
"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

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

"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"testing"

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

"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 2 additions & 4 deletions flytectl/cmd/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import (
"os"
"strings"

"github.com/flyteorg/flyte/flytectl/pkg/util"

"github.com/flyteorg/flyte/flytectl/pkg/configutil"

initConfig "github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/config"
cmdcore "github.com/flyteorg/flyte/flytectl/cmd/core"
cmdUtil "github.com/flyteorg/flyte/flytectl/pkg/commandutils"
"github.com/flyteorg/flyte/flytectl/pkg/configutil"
"github.com/flyteorg/flyte/flytectl/pkg/util"
"github.com/flyteorg/flyte/flytestdlib/config/viper"
"github.com/go-ozzo/ozzo-validation/v4/is"
"github.com/spf13/cobra"
Expand Down
7 changes: 2 additions & 5 deletions flytectl/cmd/configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ import (
"strings"
"testing"

admin2 "github.com/flyteorg/flyte/flyteidl/clients/go/admin"

"github.com/flyteorg/flyte/flytectl/pkg/configutil"

initConfig "github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/config"
cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
"github.com/flyteorg/flyte/flytectl/pkg/configutil"
"github.com/flyteorg/flyte/flytectl/pkg/util"

admin2 "github.com/flyteorg/flyte/flyteidl/clients/go/admin"
"github.com/stretchr/testify/assert"
)

Expand Down
8 changes: 3 additions & 5 deletions flytectl/cmd/core/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ import (
"context"
"fmt"

"github.com/pkg/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/pkg/pkce"
"github.com/flyteorg/flyte/flyteidl/clients/go/admin"

"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

type PFlagProvider interface {
Expand Down
3 changes: 1 addition & 2 deletions flytectl/cmd/core/cmd_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package cmdcore
import (
"io"

"github.com/flyteorg/flyte/flyteidl/clients/go/admin"

"github.com/flyteorg/flyte/flytectl/pkg/ext"
"github.com/flyteorg/flyte/flyteidl/clients/go/admin"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service"
)

Expand Down
1 change: 0 additions & 1 deletion flytectl/cmd/core/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/flyteorg/flyte/flyteidl/clients/go/admin"
"github.com/flyteorg/flyte/flytestdlib/config"

"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
)
Expand Down
1 change: 0 additions & 1 deletion flytectl/cmd/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package create
import (
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/project"
cmdcore "github.com/flyteorg/flyte/flytectl/cmd/core"

"github.com/spf13/cobra"
)

Expand Down
3 changes: 1 addition & 2 deletions flytectl/cmd/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"sort"
"testing"

"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flytectl/cmd/testutils"
"github.com/stretchr/testify/assert"
)

const testDataFolder = "../testdata/"
Expand Down
5 changes: 2 additions & 3 deletions flytectl/cmd/create/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"context"
"fmt"

"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyte/flytestdlib/logger"

"github.com/flyteorg/flyte/flytectl/cmd/config"
cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyte/flytestdlib/logger"
)

const (
Expand Down
12 changes: 5 additions & 7 deletions flytectl/cmd/create/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import (
"fmt"
"testing"

"github.com/flyteorg/flyte/flytectl/cmd/config"
cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
"github.com/flyteorg/flyte/flytectl/cmd/testutils"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
"google.golang.org/protobuf/types/known/timestamppb"

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

"github.com/flyteorg/flyte/flytectl/cmd/config"
cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
"github.com/flyteorg/flyte/flytectl/cmd/testutils"
)

type createSuite struct {
Expand Down
5 changes: 2 additions & 3 deletions flytectl/cmd/create/execution_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import (
"io/ioutil"
"strings"

cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
cmdGet "github.com/flyteorg/flyte/flytectl/cmd/get"
"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/logger"
"github.com/google/uuid"
"sigs.k8s.io/yaml"

cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
cmdGet "github.com/flyteorg/flyte/flytectl/cmd/get"
)

func createExecutionRequestForWorkflow(ctx context.Context, workflowName, project, domain string,
Expand Down
4 changes: 1 addition & 3 deletions flytectl/cmd/create/execution_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import (
"fmt"
"testing"

"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"

"github.com/flyteorg/flyte/flytectl/cmd/config"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
3 changes: 1 addition & 2 deletions flytectl/cmd/create/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"github.com/flyteorg/flyte/flytectl/clierrors"
"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/project"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyte/flytestdlib/logger"
)

Expand Down
3 changes: 0 additions & 3 deletions flytectl/cmd/create/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import (
"testing"

"github.com/flyteorg/flyte/flytectl/clierrors"

"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/project"

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

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
1 change: 0 additions & 1 deletion flytectl/cmd/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/taskresourceattribute"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/workflowexecutionconfig"
cmdcore "github.com/flyteorg/flyte/flytectl/cmd/core"

"github.com/spf13/cobra"
)

Expand Down
3 changes: 1 addition & 2 deletions flytectl/cmd/delete/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"sort"
"testing"

"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flytectl/cmd/testutils"
"github.com/stretchr/testify/assert"
)

const (
Expand Down
1 change: 0 additions & 1 deletion flytectl/cmd/delete/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"

"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/clusterresourceattribute"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/executionclusterlabel"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/executionqueueattribute"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
1 change: 0 additions & 1 deletion flytectl/cmd/delete/matchable_plugin_override_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/flyteorg/flyte/flytectl/cmd/config"
pluginoverride "github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/plugin_override"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/taskresourceattribute"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
3 changes: 1 addition & 2 deletions flytectl/cmd/delete/matchable_workflow_execution_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package delete
import (
"context"

"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/workflowexecutionconfig"

"github.com/flyteorg/flyte/flytectl/cmd/config"
sconfig "github.com/flyteorg/flyte/flytectl/cmd/config/subcommand"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/workflowexecutionconfig"
cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import (
"fmt"
"testing"

"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/workflowexecutionconfig"

"github.com/flyteorg/flyte/flytectl/cmd/config"
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/workflowexecutionconfig"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
Loading