Skip to content

Commit dc66e6b

Browse files
thaJeztahndeloof
authored andcommitted
golangci-lint: use gci formatter instead of goimports
Most files already grouped imports into "stdlib -> other -> local", but some files didn't. The gci formatter is similar to goimports, but has better options to make sure imports are grouped in the expected order (and to make sure no additional groups are present). This formatter has a 'fix' function, so code can be re-formatted auto- matically; golangci-lint run -v --fix Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 8d9d525 commit dc66e6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+238
-165
lines changed

.golangci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,18 @@ issues:
7979
max-same-issues: 0
8080
formatters:
8181
enable:
82+
- gci
8283
- gofumpt
83-
- goimports
8484
exclusions:
8585
generated: lax
8686
paths:
8787
- third_party$
8888
- builtin$
8989
- examples$
90+
settings:
91+
gci:
92+
sections:
93+
- standard
94+
- default
95+
- localmodule
96+
custom-order: true # make the section order the same as the order of "sections".

cmd/cmdtrace/cmd_span.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ import (
2626

2727
dockercli "github.com/docker/cli/cli"
2828
"github.com/docker/cli/cli/command"
29-
commands "github.com/docker/compose/v5/cmd/compose"
30-
"github.com/docker/compose/v5/internal/tracing"
3129
"github.com/spf13/cobra"
3230
flag "github.com/spf13/pflag"
3331
"go.opentelemetry.io/otel"
3432
"go.opentelemetry.io/otel/attribute"
3533
"go.opentelemetry.io/otel/codes"
3634
"go.opentelemetry.io/otel/trace"
35+
36+
commands "github.com/docker/compose/v5/cmd/compose"
37+
"github.com/docker/compose/v5/internal/tracing"
3738
)
3839

3940
// Setup should be called as part of the command's PersistentPreRunE

cmd/cmdtrace/cmd_span_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import (
2020
"reflect"
2121
"testing"
2222

23-
commands "github.com/docker/compose/v5/cmd/compose"
2423
"github.com/spf13/cobra"
2524
flag "github.com/spf13/pflag"
25+
26+
commands "github.com/docker/compose/v5/cmd/compose"
2627
)
2728

2829
func TestGetFlags(t *testing.T) {

cmd/compose/attach.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import (
2020
"context"
2121

2222
"github.com/docker/cli/cli/command"
23+
"github.com/spf13/cobra"
24+
2325
"github.com/docker/compose/v5/pkg/api"
2426
"github.com/docker/compose/v5/pkg/compose"
25-
"github.com/spf13/cobra"
2627
)
2728

2829
type attachOpts struct {

cmd/compose/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ import (
2626
"github.com/compose-spec/compose-go/v2/types"
2727
"github.com/docker/cli/cli/command"
2828
cliopts "github.com/docker/cli/opts"
29-
"github.com/docker/compose/v5/cmd/display"
30-
"github.com/docker/compose/v5/pkg/compose"
3129
"github.com/spf13/cobra"
3230

31+
"github.com/docker/compose/v5/cmd/display"
3332
"github.com/docker/compose/v5/pkg/api"
33+
"github.com/docker/compose/v5/pkg/compose"
3434
)
3535

3636
type buildOptions struct {

cmd/compose/commit.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import (
2121

2222
"github.com/docker/cli/cli/command"
2323
"github.com/docker/cli/opts"
24+
"github.com/spf13/cobra"
25+
2426
"github.com/docker/compose/v5/pkg/api"
2527
"github.com/docker/compose/v5/pkg/compose"
26-
"github.com/spf13/cobra"
2728
)
2829

2930
type commitOptions struct {

cmd/compose/completion.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import (
2121
"strings"
2222

2323
"github.com/docker/cli/cli/command"
24+
"github.com/spf13/cobra"
25+
2426
"github.com/docker/compose/v5/pkg/api"
2527
"github.com/docker/compose/v5/pkg/compose"
26-
"github.com/spf13/cobra"
2728
)
2829

2930
// validArgsFn defines a completion func to be returned to fetch completion options

cmd/compose/compose.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,18 @@ import (
3939
"github.com/docker/cli/cli-plugins/metadata"
4040
"github.com/docker/cli/cli/command"
4141
"github.com/docker/cli/pkg/kvfile"
42+
"github.com/morikuni/aec"
43+
"github.com/sirupsen/logrus"
44+
"github.com/spf13/cobra"
45+
"github.com/spf13/pflag"
46+
4247
"github.com/docker/compose/v5/cmd/display"
4348
"github.com/docker/compose/v5/cmd/formatter"
4449
"github.com/docker/compose/v5/internal/tracing"
4550
"github.com/docker/compose/v5/pkg/api"
4651
"github.com/docker/compose/v5/pkg/compose"
4752
"github.com/docker/compose/v5/pkg/remote"
4853
"github.com/docker/compose/v5/pkg/utils"
49-
"github.com/morikuni/aec"
50-
"github.com/sirupsen/logrus"
51-
"github.com/spf13/cobra"
52-
"github.com/spf13/pflag"
5354
)
5455

5556
const (

cmd/compose/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ import (
3030
"github.com/compose-spec/compose-go/v2/template"
3131
"github.com/compose-spec/compose-go/v2/types"
3232
"github.com/docker/cli/cli/command"
33-
"github.com/docker/compose/v5/cmd/formatter"
3433
"github.com/spf13/cobra"
3534
"gopkg.in/yaml.v3"
3635

36+
"github.com/docker/compose/v5/cmd/formatter"
3737
"github.com/docker/compose/v5/pkg/api"
3838
"github.com/docker/compose/v5/pkg/compose"
3939
)

cmd/compose/cp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import (
2222

2323
"github.com/docker/cli/cli"
2424
"github.com/docker/cli/cli/command"
25-
"github.com/docker/compose/v5/pkg/compose"
2625
"github.com/spf13/cobra"
2726

2827
"github.com/docker/compose/v5/pkg/api"
28+
"github.com/docker/compose/v5/pkg/compose"
2929
)
3030

3131
type copyOptions struct {

0 commit comments

Comments
 (0)