Skip to content

Commit

Permalink
Format go imports (flytestdlib) (#4228)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Dye <[email protected]>
  • Loading branch information
andrewwdye authored Oct 16, 2023
1 parent 4f6c54b commit 57309c5
Show file tree
Hide file tree
Showing 59 changed files with 151 additions and 149 deletions.
10 changes: 10 additions & 0 deletions flytestdlib/.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 All @@ -28,3 +29,12 @@ linters:
- unparam
- unused
- varcheck

linters-settings:
gci:
custom-order: true
sections:
- standard
- default
- prefix(github.com/flyteorg)
skip-generated: true
3 changes: 2 additions & 1 deletion flytestdlib/boilerplate/flyte/golang_support_tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
10 changes: 10 additions & 0 deletions flytestdlib/boilerplate/flyte/golangci_file/.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 All @@ -28,3 +29,12 @@ linters:
- unparam
- unused
- varcheck

linters-settings:
gci:
custom-order: true
sections:
- standard
- default
- prefix(github.com/flyteorg)
skip-generated: true
3 changes: 2 additions & 1 deletion flytestdlib/boilerplate/update.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
flyte/code_of_conduct
flyte/golang_test_targets
flyte/golang_support_tools
flyte/golangci_file
flyte/pull_request_template
flyte/code_of_conduct
11 changes: 4 additions & 7 deletions flytestdlib/cache/auto_refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ import (
"sync"
"time"

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

lru "github.com/hashicorp/golang-lru"
"github.com/prometheus/client_golang/prometheus"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/util/workqueue"

"github.com/flyteorg/flyte/flytestdlib/contextutils"
"github.com/flyteorg/flyte/flytestdlib/errors"

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

"github.com/flyteorg/flyte/flytestdlib/promutils"
lru "github.com/hashicorp/golang-lru"
"github.com/prometheus/client_golang/prometheus"
"k8s.io/apimachinery/pkg/util/wait"
)

type ItemID = string
Expand Down
1 change: 0 additions & 1 deletion flytestdlib/cache/auto_refresh_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"k8s.io/client-go/util/workqueue"

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

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

Expand Down
7 changes: 2 additions & 5 deletions flytestdlib/cache/auto_refresh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ import (
"testing"
"time"

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

"github.com/stretchr/testify/assert"
"k8s.io/client-go/util/workqueue"

"github.com/flyteorg/flyte/flytestdlib/atomic"
"github.com/flyteorg/flyte/flytestdlib/errors"

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

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

const fakeCacheItemValueLimit = 10
Expand Down
5 changes: 2 additions & 3 deletions flytestdlib/cli/pflags/api/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import (
"path/filepath"
"strings"

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

"github.com/ernesto-jimenez/gogen/gogenutil"
"golang.org/x/tools/go/packages"

"github.com/ernesto-jimenez/gogen/gogenutil"
"github.com/flyteorg/flyte/flytestdlib/logger"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion flytestdlib/cli/pflags/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"fmt"
"strings"

"github.com/spf13/cobra"

"github.com/flyteorg/flyte/flytestdlib/cli/pflags/api"
"github.com/flyteorg/flyte/flytestdlib/logger"
"github.com/spf13/cobra"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion flytestdlib/cli/pflags/cmd/version.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package cmd

import (
"github.com/flyteorg/flyte/flytestdlib/version"
"github.com/spf13/cobra"

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

var versionCmd = &cobra.Command{
Expand Down
5 changes: 2 additions & 3 deletions flytestdlib/config/config_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import (
"strings"
"unsafe"

"github.com/ghodss/yaml"
"k8s.io/apimachinery/pkg/util/sets"

"github.com/fatih/color"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/util/sets"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions flytestdlib/config/regexp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"reflect"
"testing"

"github.com/flyteorg/flyte/flytestdlib/internal/utils"

"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flytestdlib/internal/utils"
)

func TestRegexp_MarshalJSON(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions flytestdlib/config/section.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"strings"
"sync"

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

"github.com/spf13/pflag"

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

type Section interface {
Expand Down
7 changes: 3 additions & 4 deletions flytestdlib/config/section_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import (
"testing"
"time"

"k8s.io/apimachinery/pkg/util/rand"

"github.com/flyteorg/flyte/flytestdlib/internal/utils"
"github.com/ghodss/yaml"
"github.com/spf13/pflag"

"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/util/rand"

"github.com/flyteorg/flyte/flytestdlib/internal/utils"
)

// Make sure existing config file(s) parse correctly before overriding them with this flag!
Expand Down
7 changes: 3 additions & 4 deletions flytestdlib/config/tests/accessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ import (
"testing"
"time"

"github.com/ghodss/yaml"
"github.com/spf13/pflag"
"github.com/stretchr/testify/assert"
k8sRand "k8s.io/apimachinery/pkg/util/rand"

"github.com/flyteorg/flyte/flytestdlib/config"
"github.com/flyteorg/flyte/flytestdlib/internal/utils"
"github.com/spf13/pflag"

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

type accessorCreatorFn func(registry config.Section, configPath string) config.Accessor
Expand Down
4 changes: 2 additions & 2 deletions flytestdlib/config/tests/config_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"testing"

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

"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"

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

func executeCommand(root *cobra.Command, args ...string) (output string, err error) {
Expand Down
4 changes: 2 additions & 2 deletions flytestdlib/config/tests/types_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package tests

import (
"encoding/json"
"fmt"

"encoding/json"
"github.com/spf13/pflag"

"github.com/flyteorg/flyte/flytestdlib/config"
"github.com/flyteorg/flyte/flytestdlib/config/viper"
"github.com/spf13/pflag"
)

const testNameFormatter = "[%v] %v"
Expand Down
4 changes: 2 additions & 2 deletions flytestdlib/config/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"reflect"
"testing"

"github.com/flyteorg/flyte/flytestdlib/internal/utils"

"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flytestdlib/internal/utils"
)

func TestURL_MarshalJSON(t *testing.T) {
Expand Down
10 changes: 4 additions & 6 deletions flytestdlib/config/viper/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import (
"os"
"strings"

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

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

viperLib "github.com/spf13/viper"

"github.com/fsnotify/fsnotify"
"github.com/spf13/pflag"
viperLib "github.com/spf13/viper"

"github.com/flyteorg/flyte/flytestdlib/errors"
"github.com/flyteorg/flyte/flytestdlib/logger"
)

type Viper interface {
Expand Down
17 changes: 6 additions & 11 deletions flytestdlib/config/viper/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,18 @@ import (
"strings"
"sync"

"k8s.io/apimachinery/pkg/util/sets"

"github.com/fsnotify/fsnotify"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"

stdLibErrs "github.com/flyteorg/flyte/flytestdlib/errors"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
viperLib "github.com/spf13/viper"
"k8s.io/apimachinery/pkg/util/sets"

"github.com/flyteorg/flyte/flytestdlib/config"
"github.com/flyteorg/flyte/flytestdlib/config/files"
stdLibErrs "github.com/flyteorg/flyte/flytestdlib/errors"
"github.com/flyteorg/flyte/flytestdlib/logger"

"github.com/fsnotify/fsnotify"
"github.com/mitchellh/mapstructure"

"github.com/spf13/pflag"
viperLib "github.com/spf13/viper"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion flytestdlib/database/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"

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

func TestParseDatabaseConfig(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions flytestdlib/database/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"time"

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

gormLogger "gorm.io/gorm/logger"

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

// GetGormLogger converts between the flytestdlib configured log level to the equivalent gorm log level and outputs
Expand Down
3 changes: 2 additions & 1 deletion flytestdlib/fastcheck/fastcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"math/rand"
"testing"

"github.com/stretchr/testify/assert"

"github.com/flyteorg/flyte/flytestdlib/contextutils"
"github.com/flyteorg/flyte/flytestdlib/promutils"
"github.com/flyteorg/flyte/flytestdlib/promutils/labeled"
"github.com/stretchr/testify/assert"
)

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

"github.com/flyteorg/flyte/flytestdlib/promutils"
cache "github.com/hashicorp/golang-lru"

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

// validate that it conforms to the interface
Expand Down
3 changes: 2 additions & 1 deletion flytestdlib/ioutils/timed_readers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"testing"
"time"

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

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

func TestReadAll(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions flytestdlib/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"runtime"
"strings"

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

"github.com/sirupsen/logrus"

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

const (
Expand Down
Loading

0 comments on commit 57309c5

Please sign in to comment.