diff --git a/.golangci.yml b/.golangci.yml index 1d8ae0bb3e..48898c4571 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -79,11 +79,18 @@ issues: max-same-issues: 0 formatters: enable: + - gci - gofumpt - - goimports exclusions: generated: lax paths: - third_party$ - builtin$ - examples$ + settings: + gci: + sections: + - standard + - default + - localmodule + custom-order: true # make the section order the same as the order of "sections". diff --git a/cmd/cmdtrace/cmd_span.go b/cmd/cmdtrace/cmd_span.go index 365f95f7ca..cce3e5db3f 100644 --- a/cmd/cmdtrace/cmd_span.go +++ b/cmd/cmdtrace/cmd_span.go @@ -26,14 +26,15 @@ import ( dockercli "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - commands "github.com/docker/compose/v5/cmd/compose" - "github.com/docker/compose/v5/internal/tracing" "github.com/spf13/cobra" flag "github.com/spf13/pflag" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" + + commands "github.com/docker/compose/v5/cmd/compose" + "github.com/docker/compose/v5/internal/tracing" ) // Setup should be called as part of the command's PersistentPreRunE diff --git a/cmd/cmdtrace/cmd_span_test.go b/cmd/cmdtrace/cmd_span_test.go index 0a3c8efecf..27becd3c36 100644 --- a/cmd/cmdtrace/cmd_span_test.go +++ b/cmd/cmdtrace/cmd_span_test.go @@ -20,9 +20,10 @@ import ( "reflect" "testing" - commands "github.com/docker/compose/v5/cmd/compose" "github.com/spf13/cobra" flag "github.com/spf13/pflag" + + commands "github.com/docker/compose/v5/cmd/compose" ) func TestGetFlags(t *testing.T) { diff --git a/cmd/compose/attach.go b/cmd/compose/attach.go index bef1b46572..20f23fca20 100644 --- a/cmd/compose/attach.go +++ b/cmd/compose/attach.go @@ -20,9 +20,10 @@ import ( "context" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type attachOpts struct { diff --git a/cmd/compose/build.go b/cmd/compose/build.go index 0a710a9eae..996cf4d9ef 100644 --- a/cmd/compose/build.go +++ b/cmd/compose/build.go @@ -26,11 +26,11 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" cliopts "github.com/docker/cli/opts" - "github.com/docker/compose/v5/cmd/display" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" + "github.com/docker/compose/v5/cmd/display" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type buildOptions struct { diff --git a/cmd/compose/commit.go b/cmd/compose/commit.go index ede09dc95e..730deb2e56 100644 --- a/cmd/compose/commit.go +++ b/cmd/compose/commit.go @@ -21,9 +21,10 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/opts" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type commitOptions struct { diff --git a/cmd/compose/completion.go b/cmd/compose/completion.go index 14266a4906..0d6c9fe4d4 100644 --- a/cmd/compose/completion.go +++ b/cmd/compose/completion.go @@ -21,9 +21,10 @@ import ( "strings" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) // validArgsFn defines a completion func to be returned to fetch completion options diff --git a/cmd/compose/compose.go b/cmd/compose/compose.go index 6f6502e9d6..ad58555a17 100644 --- a/cmd/compose/compose.go +++ b/cmd/compose/compose.go @@ -39,6 +39,11 @@ import ( "github.com/docker/cli/cli-plugins/metadata" "github.com/docker/cli/cli/command" "github.com/docker/cli/pkg/kvfile" + "github.com/morikuni/aec" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "github.com/docker/compose/v5/cmd/display" "github.com/docker/compose/v5/cmd/formatter" "github.com/docker/compose/v5/internal/tracing" @@ -46,10 +51,6 @@ import ( "github.com/docker/compose/v5/pkg/compose" "github.com/docker/compose/v5/pkg/remote" "github.com/docker/compose/v5/pkg/utils" - "github.com/morikuni/aec" - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - "github.com/spf13/pflag" ) const ( diff --git a/cmd/compose/config.go b/cmd/compose/config.go index 14d4d47b96..c126ababde 100644 --- a/cmd/compose/config.go +++ b/cmd/compose/config.go @@ -30,10 +30,10 @@ import ( "github.com/compose-spec/compose-go/v2/template" "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/cmd/formatter" "github.com/spf13/cobra" "gopkg.in/yaml.v3" + "github.com/docker/compose/v5/cmd/formatter" "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" ) diff --git a/cmd/compose/cp.go b/cmd/compose/cp.go index 05e6123664..17f7411309 100644 --- a/cmd/compose/cp.go +++ b/cmd/compose/cp.go @@ -22,10 +22,10 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type copyOptions struct { diff --git a/cmd/compose/create.go b/cmd/compose/create.go index 481fe3277a..fa6432c88c 100644 --- a/cmd/compose/create.go +++ b/cmd/compose/create.go @@ -26,12 +26,12 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type createOptions struct { diff --git a/cmd/compose/down.go b/cmd/compose/down.go index 8a3df48390..9678316650 100644 --- a/cmd/compose/down.go +++ b/cmd/compose/down.go @@ -23,13 +23,13 @@ import ( "time" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" - "github.com/docker/compose/v5/pkg/utils" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" + "github.com/docker/compose/v5/pkg/utils" ) type downOptions struct { diff --git a/cmd/compose/events.go b/cmd/compose/events.go index fb333e62e7..79b8b82047 100644 --- a/cmd/compose/events.go +++ b/cmd/compose/events.go @@ -22,10 +22,10 @@ import ( "fmt" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - - "github.com/spf13/cobra" ) type eventsOpts struct { diff --git a/cmd/compose/exec.go b/cmd/compose/exec.go index 761a7b6da1..f548730dc0 100644 --- a/cmd/compose/exec.go +++ b/cmd/compose/exec.go @@ -25,11 +25,12 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/compose" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" + + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type execOpts struct { diff --git a/cmd/compose/export.go b/cmd/compose/export.go index 5cafa7fd99..4c7eaf7ef5 100644 --- a/cmd/compose/export.go +++ b/cmd/compose/export.go @@ -20,10 +20,10 @@ import ( "context" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type exportOptions struct { diff --git a/cmd/compose/generate.go b/cmd/compose/generate.go index b6e27a358c..3fe5b2389e 100644 --- a/cmd/compose/generate.go +++ b/cmd/compose/generate.go @@ -22,9 +22,10 @@ import ( "os" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type generateOptions struct { diff --git a/cmd/compose/images.go b/cmd/compose/images.go index ca4be27fe3..dbb7a56471 100644 --- a/cmd/compose/images.go +++ b/cmd/compose/images.go @@ -27,13 +27,13 @@ import ( "github.com/containerd/platforms" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/docker/docker/pkg/stringid" "github.com/docker/go-units" "github.com/spf13/cobra" "github.com/docker/compose/v5/cmd/formatter" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type imageOptions struct { diff --git a/cmd/compose/kill.go b/cmd/compose/kill.go index 8c8a0a27b3..ee488d2ec6 100644 --- a/cmd/compose/kill.go +++ b/cmd/compose/kill.go @@ -23,10 +23,10 @@ import ( "os" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" "github.com/docker/compose/v5/pkg/utils" ) diff --git a/cmd/compose/list.go b/cmd/compose/list.go index d7ce49b9ae..eaa843ac37 100644 --- a/cmd/compose/list.go +++ b/cmd/compose/list.go @@ -23,13 +23,12 @@ import ( "strings" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/cmd/formatter" - "github.com/docker/compose/v5/pkg/compose" - "github.com/docker/cli/opts" "github.com/spf13/cobra" + "github.com/docker/compose/v5/cmd/formatter" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type lsOptions struct { diff --git a/cmd/compose/logs.go b/cmd/compose/logs.go index 185b82a14a..de1452220b 100644 --- a/cmd/compose/logs.go +++ b/cmd/compose/logs.go @@ -21,11 +21,11 @@ import ( "errors" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/cmd/formatter" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type logsOptions struct { diff --git a/cmd/compose/options.go b/cmd/compose/options.go index f243bd6f58..2cab4742ca 100644 --- a/cmd/compose/options.go +++ b/cmd/compose/options.go @@ -30,6 +30,7 @@ import ( "github.com/compose-spec/compose-go/v2/template" "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" + "github.com/docker/compose/v5/cmd/display" "github.com/docker/compose/v5/cmd/prompt" "github.com/docker/compose/v5/internal/tracing" diff --git a/cmd/compose/options_test.go b/cmd/compose/options_test.go index cac2f83023..db6e8c0a87 100644 --- a/cmd/compose/options_test.go +++ b/cmd/compose/options_test.go @@ -28,9 +28,10 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/streams" - "github.com/docker/compose/v5/pkg/mocks" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" + + "github.com/docker/compose/v5/pkg/mocks" ) func TestApplyPlatforms_InferFromRuntime(t *testing.T) { diff --git a/cmd/compose/pause.go b/cmd/compose/pause.go index b7e00b7804..bb4cedba2a 100644 --- a/cmd/compose/pause.go +++ b/cmd/compose/pause.go @@ -20,10 +20,10 @@ import ( "context" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type pauseOptions struct { diff --git a/cmd/compose/port.go b/cmd/compose/port.go index a117926fd1..862e3b5d68 100644 --- a/cmd/compose/port.go +++ b/cmd/compose/port.go @@ -23,10 +23,10 @@ import ( "strings" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type portOptions struct { diff --git a/cmd/compose/ps.go b/cmd/compose/ps.go index 4059774161..37a39eef97 100644 --- a/cmd/compose/ps.go +++ b/cmd/compose/ps.go @@ -24,14 +24,14 @@ import ( "sort" "strings" - "github.com/docker/compose/v5/cmd/formatter" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/compose" - "github.com/docker/cli/cli/command" cliformatter "github.com/docker/cli/cli/command/formatter" cliflags "github.com/docker/cli/cli/flags" "github.com/spf13/cobra" + + "github.com/docker/compose/v5/cmd/formatter" + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type psOptions struct { diff --git a/cmd/compose/publish.go b/cmd/compose/publish.go index 45d5caf7b8..6dba282ebc 100644 --- a/cmd/compose/publish.go +++ b/cmd/compose/publish.go @@ -22,11 +22,12 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/compose" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" + + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type publishOptions struct { diff --git a/cmd/compose/pull.go b/cmd/compose/pull.go index c3ec6d5226..694731155f 100644 --- a/cmd/compose/pull.go +++ b/cmd/compose/pull.go @@ -24,11 +24,11 @@ import ( "github.com/compose-spec/compose-go/v2/cli" "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/morikuni/aec" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type pullOptions struct { diff --git a/cmd/compose/push.go b/cmd/compose/push.go index 39d85f8a8f..4dd23aedb6 100644 --- a/cmd/compose/push.go +++ b/cmd/compose/push.go @@ -21,10 +21,10 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type pushOptions struct { diff --git a/cmd/compose/remove.go b/cmd/compose/remove.go index 6501afb9fe..d0765b20a5 100644 --- a/cmd/compose/remove.go +++ b/cmd/compose/remove.go @@ -22,9 +22,10 @@ import ( "fmt" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type removeOptions struct { diff --git a/cmd/compose/restart.go b/cmd/compose/restart.go index a2880d3c8e..e014b2a8ef 100644 --- a/cmd/compose/restart.go +++ b/cmd/compose/restart.go @@ -21,10 +21,10 @@ import ( "time" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type restartOptions struct { diff --git a/cmd/compose/run.go b/cmd/compose/run.go index e086a1f557..01438a857e 100644 --- a/cmd/compose/run.go +++ b/cmd/compose/run.go @@ -25,20 +25,19 @@ import ( composecli "github.com/compose-spec/compose-go/v2/cli" "github.com/compose-spec/compose-go/v2/dotenv" "github.com/compose-spec/compose-go/v2/format" - "github.com/docker/compose/v5/cmd/display" - "github.com/docker/compose/v5/pkg/compose" - xprogress "github.com/moby/buildkit/util/progress/progressui" - "github.com/sirupsen/logrus" - "github.com/compose-spec/compose-go/v2/types" + "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/docker/cli/opts" "github.com/mattn/go-shellwords" + xprogress "github.com/moby/buildkit/util/progress/progressui" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" - "github.com/docker/cli/cli" + "github.com/docker/compose/v5/cmd/display" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" "github.com/docker/compose/v5/pkg/utils" ) diff --git a/cmd/compose/scale.go b/cmd/compose/scale.go index 40baeae34d..8070858e9a 100644 --- a/cmd/compose/scale.go +++ b/cmd/compose/scale.go @@ -26,9 +26,10 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type scaleOptions struct { diff --git a/cmd/compose/start.go b/cmd/compose/start.go index 3a2bd2afad..a2bb05797c 100644 --- a/cmd/compose/start.go +++ b/cmd/compose/start.go @@ -21,9 +21,10 @@ import ( "time" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type startOptions struct { diff --git a/cmd/compose/stop.go b/cmd/compose/stop.go index 67f299e048..6bc3faaa96 100644 --- a/cmd/compose/stop.go +++ b/cmd/compose/stop.go @@ -21,10 +21,10 @@ import ( "time" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type stopOptions struct { diff --git a/cmd/compose/top.go b/cmd/compose/top.go index b1b9ae42a9..0d7f969c84 100644 --- a/cmd/compose/top.go +++ b/cmd/compose/top.go @@ -25,10 +25,10 @@ import ( "text/tabwriter" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/compose" "github.com/spf13/cobra" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type topOptions struct { diff --git a/cmd/compose/top_test.go b/cmd/compose/top_test.go index a88ae74ee6..3e212ed85b 100644 --- a/cmd/compose/top_test.go +++ b/cmd/compose/top_test.go @@ -21,9 +21,10 @@ import ( "strings" "testing" - "github.com/docker/compose/v5/pkg/api" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/docker/compose/v5/pkg/api" ) var topTestCases = []struct { diff --git a/cmd/compose/up.go b/cmd/compose/up.go index 7b9807c993..5819900823 100644 --- a/cmd/compose/up.go +++ b/cmd/compose/up.go @@ -26,15 +26,15 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/cmd/display" - "github.com/docker/compose/v5/pkg/compose" xprogress "github.com/moby/buildkit/util/progress/progressui" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" + "github.com/docker/compose/v5/cmd/display" "github.com/docker/compose/v5/cmd/formatter" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" "github.com/docker/compose/v5/pkg/utils" ) diff --git a/cmd/compose/version.go b/cmd/compose/version.go index 86afcd189d..4302c15697 100644 --- a/cmd/compose/version.go +++ b/cmd/compose/version.go @@ -21,10 +21,9 @@ import ( "strings" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/cmd/formatter" - "github.com/spf13/cobra" + "github.com/docker/compose/v5/cmd/formatter" "github.com/docker/compose/v5/internal" ) diff --git a/cmd/compose/version_test.go b/cmd/compose/version_test.go index cedaf63c47..c9bf9b74ea 100644 --- a/cmd/compose/version_test.go +++ b/cmd/compose/version_test.go @@ -21,10 +21,11 @@ import ( "testing" "github.com/docker/cli/cli/streams" - "github.com/docker/compose/v5/internal" - "github.com/docker/compose/v5/pkg/mocks" "go.uber.org/mock/gomock" "gotest.tools/v3/assert" + + "github.com/docker/compose/v5/internal" + "github.com/docker/compose/v5/pkg/mocks" ) func TestVersionCommand(t *testing.T) { diff --git a/cmd/compose/viz.go b/cmd/compose/viz.go index a3e54883d3..443d78c626 100644 --- a/cmd/compose/viz.go +++ b/cmd/compose/viz.go @@ -23,9 +23,10 @@ import ( "strings" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type vizOptions struct { diff --git a/cmd/compose/volumes.go b/cmd/compose/volumes.go index eae4dbcbcd..e0da4f82e3 100644 --- a/cmd/compose/volumes.go +++ b/cmd/compose/volumes.go @@ -24,9 +24,10 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/formatter" "github.com/docker/cli/cli/flags" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type volumesOptions struct { diff --git a/cmd/compose/wait.go b/cmd/compose/wait.go index f8b30f6933..9d86fd314c 100644 --- a/cmd/compose/wait.go +++ b/cmd/compose/wait.go @@ -22,9 +22,10 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" + "github.com/spf13/cobra" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/compose" - "github.com/spf13/cobra" ) type waitOptions struct { diff --git a/cmd/compose/watch.go b/cmd/compose/watch.go index b77617e4cf..c60b243860 100644 --- a/cmd/compose/watch.go +++ b/cmd/compose/watch.go @@ -21,14 +21,14 @@ import ( "fmt" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/cmd/formatter" - "github.com/docker/compose/v5/pkg/compose" - "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/internal/locker" - "github.com/docker/compose/v5/pkg/api" "github.com/sirupsen/logrus" "github.com/spf13/cobra" + + "github.com/docker/compose/v5/cmd/formatter" + "github.com/docker/compose/v5/internal/locker" + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose" ) type watchOptions struct { diff --git a/cmd/display/json_test.go b/cmd/display/json_test.go index 26895dc102..0f0dff23a6 100644 --- a/cmd/display/json_test.go +++ b/cmd/display/json_test.go @@ -21,8 +21,9 @@ import ( "encoding/json" "testing" - "github.com/docker/compose/v5/pkg/api" "gotest.tools/v3/assert" + + "github.com/docker/compose/v5/pkg/api" ) func TestJsonWriter_Event(t *testing.T) { diff --git a/cmd/display/tty.go b/cmd/display/tty.go index 0cb1519300..96157a019b 100644 --- a/cmd/display/tty.go +++ b/cmd/display/tty.go @@ -24,11 +24,11 @@ import ( "sync" "time" - "github.com/docker/compose/v5/pkg/api" - "github.com/buger/goterm" "github.com/docker/go-units" "github.com/morikuni/aec" + + "github.com/docker/compose/v5/pkg/api" ) // Full creates an EventProcessor that render advanced UI within a terminal. diff --git a/cmd/formatter/container.go b/cmd/formatter/container.go index 074ef00c18..622d6a3e27 100644 --- a/cmd/formatter/container.go +++ b/cmd/formatter/container.go @@ -23,10 +23,11 @@ import ( "time" "github.com/docker/cli/cli/command/formatter" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" "github.com/docker/docker/pkg/stringid" "github.com/docker/go-units" + + "github.com/docker/compose/v5/pkg/api" ) const ( diff --git a/cmd/formatter/logs.go b/cmd/formatter/logs.go index fda6a1da16..a97055b37a 100644 --- a/cmd/formatter/logs.go +++ b/cmd/formatter/logs.go @@ -26,8 +26,9 @@ import ( "time" "github.com/buger/goterm" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/pkg/jsonmessage" + + "github.com/docker/compose/v5/pkg/api" ) // LogConsumer consume logs from services and format them diff --git a/cmd/formatter/shortcut.go b/cmd/formatter/shortcut.go index bb814cfa54..16e8fc2e7a 100644 --- a/cmd/formatter/shortcut.go +++ b/cmd/formatter/shortcut.go @@ -28,10 +28,11 @@ import ( "github.com/buger/goterm" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/internal/tracing" - "github.com/docker/compose/v5/pkg/api" "github.com/eiannone/keyboard" "github.com/skratchdot/open-golang/open" + + "github.com/docker/compose/v5/internal/tracing" + "github.com/docker/compose/v5/pkg/api" ) const DISPLAY_ERROR_TIME = 10 diff --git a/cmd/main.go b/cmd/main.go index c5afdb5338..7a5ec58d60 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -23,13 +23,13 @@ import ( "github.com/docker/cli/cli-plugins/metadata" "github.com/docker/cli/cli-plugins/plugin" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/cmd/cmdtrace" - "github.com/docker/compose/v5/cmd/prompt" "github.com/sirupsen/logrus" "github.com/spf13/cobra" + "github.com/docker/compose/v5/cmd/cmdtrace" "github.com/docker/compose/v5/cmd/compatibility" commands "github.com/docker/compose/v5/cmd/compose" + "github.com/docker/compose/v5/cmd/prompt" "github.com/docker/compose/v5/internal" "github.com/docker/compose/v5/pkg/compose" ) diff --git a/cmd/prompt/prompt.go b/cmd/prompt/prompt.go index 722ba64b0b..87379f5eb6 100644 --- a/cmd/prompt/prompt.go +++ b/cmd/prompt/prompt.go @@ -22,6 +22,7 @@ import ( "github.com/AlecAivazis/survey/v2" "github.com/docker/cli/cli/streams" + "github.com/docker/compose/v5/pkg/utils" ) diff --git a/docs/yaml/main/generate.go b/docs/yaml/main/generate.go index 272727b008..335efe9cc3 100644 --- a/docs/yaml/main/generate.go +++ b/docs/yaml/main/generate.go @@ -23,8 +23,9 @@ import ( clidocstool "github.com/docker/cli-docs-tool" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/cmd/compose" "github.com/spf13/cobra" + + "github.com/docker/compose/v5/cmd/compose" ) func generateDocs(opts *options) error { diff --git a/internal/desktop/client.go b/internal/desktop/client.go index f46a6443cc..1e28899370 100644 --- a/internal/desktop/client.go +++ b/internal/desktop/client.go @@ -25,9 +25,10 @@ import ( "net/http" "strings" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + "github.com/docker/compose/v5/internal" "github.com/docker/compose/v5/internal/memnet" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" ) // identify this client in the logs diff --git a/internal/oci/push.go b/internal/oci/push.go index fe3ca58665..1e2d0f2e95 100644 --- a/internal/oci/push.go +++ b/internal/oci/push.go @@ -29,10 +29,11 @@ import ( "github.com/containerd/containerd/v2/core/remotes" pusherrors "github.com/containerd/containerd/v2/core/remotes/errors" "github.com/distribution/reference" - "github.com/docker/compose/v5/pkg/api" "github.com/opencontainers/go-digest" "github.com/opencontainers/image-spec/specs-go" v1 "github.com/opencontainers/image-spec/specs-go/v1" + + "github.com/docker/compose/v5/pkg/api" ) const ( diff --git a/internal/oci/resolver.go b/internal/oci/resolver.go index 6277ab61be..f18c474de5 100644 --- a/internal/oci/resolver.go +++ b/internal/oci/resolver.go @@ -29,9 +29,10 @@ import ( "github.com/containerd/errdefs" "github.com/distribution/reference" "github.com/docker/cli/cli/config/configfile" - "github.com/docker/compose/v5/internal/registry" "github.com/moby/buildkit/util/contentutil" spec "github.com/opencontainers/image-spec/specs-go/v1" + + "github.com/docker/compose/v5/internal/registry" ) // NewResolver setup an OCI Resolver based on docker/cli config to provide registry credentials diff --git a/internal/tracing/docker_context.go b/internal/tracing/docker_context.go index 75f988d19a..97e682ac7c 100644 --- a/internal/tracing/docker_context.go +++ b/internal/tracing/docker_context.go @@ -22,11 +22,12 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/context/store" - "github.com/docker/compose/v5/internal/memnet" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + + "github.com/docker/compose/v5/internal/memnet" ) const otelConfigFieldName = "otel" diff --git a/internal/tracing/tracing.go b/internal/tracing/tracing.go index cab8ee3b29..ec09f61e8b 100644 --- a/internal/tracing/tracing.go +++ b/internal/tracing/tracing.go @@ -23,19 +23,19 @@ import ( "os" "strings" - "github.com/docker/compose/v5/internal" - "go.opentelemetry.io/otel/attribute" - "github.com/docker/cli/cli/command" "github.com/moby/buildkit/util/tracing/detect" _ "github.com/moby/buildkit/util/tracing/env" //nolint:blank-imports "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + + "github.com/docker/compose/v5/internal" ) func init() { diff --git a/pkg/api/labels_test.go b/pkg/api/labels_test.go index 61b2d8b61e..c4af2003e9 100644 --- a/pkg/api/labels_test.go +++ b/pkg/api/labels_test.go @@ -19,9 +19,10 @@ package api import ( "testing" - "github.com/docker/compose/v5/internal" "github.com/hashicorp/go-version" "gotest.tools/v3/assert" + + "github.com/docker/compose/v5/internal" ) func TestComposeVersionInitialization(t *testing.T) { diff --git a/pkg/bridge/convert.go b/pkg/bridge/convert.go index c74dbbfacf..30da007ae7 100644 --- a/pkg/bridge/convert.go +++ b/pkg/bridge/convert.go @@ -30,14 +30,15 @@ import ( "github.com/containerd/errdefs" "github.com/docker/cli/cli/command" cli "github.com/docker/cli/cli/command/container" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/utils" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/go-connections/nat" "gopkg.in/yaml.v3" + + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/utils" ) type ConvertOptions struct { diff --git a/pkg/compose/attach_service.go b/pkg/compose/attach_service.go index 7f41e773a4..c6209e0224 100644 --- a/pkg/compose/attach_service.go +++ b/pkg/compose/attach_service.go @@ -21,6 +21,7 @@ import ( "strings" "github.com/docker/cli/cli/command/container" + "github.com/docker/compose/v5/pkg/api" ) diff --git a/pkg/compose/build.go b/pkg/compose/build.go index 361ae5323a..d505f510b5 100644 --- a/pkg/compose/build.go +++ b/pkg/compose/build.go @@ -24,11 +24,12 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/containerd/platforms" + specs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/sirupsen/logrus" + "github.com/docker/compose/v5/internal/tracing" "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/utils" - specs "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/sirupsen/logrus" ) func (s *composeService) Build(ctx context.Context, project *types.Project, options api.BuildOptions) error { diff --git a/pkg/compose/build_bake.go b/pkg/compose/build_bake.go index b816c4a09a..0bdfc5cfff 100644 --- a/pkg/compose/build_bake.go +++ b/pkg/compose/build_bake.go @@ -39,7 +39,6 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/image/build" "github.com/docker/cli/cli/streams" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/versions" "github.com/google/uuid" "github.com/moby/buildkit/client" @@ -48,6 +47,8 @@ import ( "github.com/sirupsen/logrus" "github.com/spf13/cobra" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" ) func buildWithBake(dockerCli command.Cli) (bool, error) { diff --git a/pkg/compose/build_classic.go b/pkg/compose/build_classic.go index 2157ffdecb..1cfa257532 100644 --- a/pkg/compose/build_classic.go +++ b/pkg/compose/build_classic.go @@ -29,7 +29,6 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command/image/build" - "github.com/docker/compose/v5/pkg/api" buildtypes "github.com/docker/docker/api/types/build" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/registry" @@ -40,6 +39,8 @@ import ( "github.com/sirupsen/logrus" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) doBuildClassic(ctx context.Context, project *types.Project, serviceToBuild types.Services, options api.BuildOptions) (map[string]string, error) { diff --git a/pkg/compose/commit.go b/pkg/compose/commit.go index f50e8fc22e..70b22d5d78 100644 --- a/pkg/compose/commit.go +++ b/pkg/compose/commit.go @@ -21,8 +21,9 @@ import ( "fmt" "strings" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Commit(ctx context.Context, projectName string, options api.CommitOptions) error { diff --git a/pkg/compose/compose.go b/pkg/compose/compose.go index 8440656c8a..2ce1255d91 100644 --- a/pkg/compose/compose.go +++ b/pkg/compose/compose.go @@ -31,7 +31,6 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/flags" "github.com/docker/cli/cli/streams" - "github.com/docker/compose/v5/pkg/dryrun" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/network" @@ -42,6 +41,7 @@ import ( "github.com/sirupsen/logrus" "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/dryrun" ) type Option func(service *composeService) error diff --git a/pkg/compose/containers.go b/pkg/compose/containers.go index fddf8057d6..50e8ad5601 100644 --- a/pkg/compose/containers.go +++ b/pkg/compose/containers.go @@ -24,9 +24,10 @@ import ( "strconv" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" + + "github.com/docker/compose/v5/pkg/api" ) // Containers is a set of moby Container diff --git a/pkg/compose/cp.go b/pkg/compose/cp.go index f236a2a1a7..66c4917e51 100644 --- a/pkg/compose/cp.go +++ b/pkg/compose/cp.go @@ -25,12 +25,12 @@ import ( "path/filepath" "strings" - "golang.org/x/sync/errgroup" - "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" "github.com/moby/go-archive" + "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" ) type copyDirection int diff --git a/pkg/compose/create_test.go b/pkg/compose/create_test.go index d6470abe2a..a3cc540692 100644 --- a/pkg/compose/create_test.go +++ b/pkg/compose/create_test.go @@ -24,18 +24,16 @@ import ( "testing" composeloader "github.com/compose-spec/compose-go/v2/loader" + composetypes "github.com/compose-spec/compose-go/v2/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/image" + mountTypes "github.com/docker/docker/api/types/mount" + "github.com/docker/docker/api/types/network" "go.uber.org/mock/gomock" + "gotest.tools/v3/assert" "gotest.tools/v3/assert/cmp" "github.com/docker/compose/v5/pkg/api" - "github.com/docker/docker/api/types/network" - - composetypes "github.com/compose-spec/compose-go/v2/types" - mountTypes "github.com/docker/docker/api/types/mount" - - "gotest.tools/v3/assert" ) func TestBuildBindMount(t *testing.T) { diff --git a/pkg/compose/dependencies.go b/pkg/compose/dependencies.go index c5d3b35da9..c448fd5a17 100644 --- a/pkg/compose/dependencies.go +++ b/pkg/compose/dependencies.go @@ -24,8 +24,9 @@ import ( "sync" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/pkg/api" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" ) // ServiceStatus indicates the status of a service diff --git a/pkg/compose/dependencies_test.go b/pkg/compose/dependencies_test.go index 904d975fb3..56e9298b50 100644 --- a/pkg/compose/dependencies_test.go +++ b/pkg/compose/dependencies_test.go @@ -24,10 +24,11 @@ import ( "testing" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/pkg/utils" testify "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gotest.tools/v3/assert" + + "github.com/docker/compose/v5/pkg/utils" ) func createTestProject() *types.Project { diff --git a/pkg/compose/down.go b/pkg/compose/down.go index 4d57bcfed0..7915e2dcb0 100644 --- a/pkg/compose/down.go +++ b/pkg/compose/down.go @@ -24,14 +24,15 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/containerd/errdefs" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/utils" containerType "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" imageapi "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/utils" ) type downOp func() error diff --git a/pkg/compose/exec.go b/pkg/compose/exec.go index b1f4666f33..311aebaa2c 100644 --- a/pkg/compose/exec.go +++ b/pkg/compose/exec.go @@ -23,8 +23,9 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command/container" - "github.com/docker/compose/v5/pkg/api" containerType "github.com/docker/docker/api/types/container" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Exec(ctx context.Context, projectName string, options api.RunOptions) (int, error) { diff --git a/pkg/compose/export.go b/pkg/compose/export.go index 65dd31cd1b..5de9d837be 100644 --- a/pkg/compose/export.go +++ b/pkg/compose/export.go @@ -23,8 +23,9 @@ import ( "strings" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/api" "github.com/moby/sys/atomicwriter" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Export(ctx context.Context, projectName string, options api.ExportOptions) error { diff --git a/pkg/compose/filters.go b/pkg/compose/filters.go index 794803160d..f3038ab144 100644 --- a/pkg/compose/filters.go +++ b/pkg/compose/filters.go @@ -19,8 +19,9 @@ package compose import ( "fmt" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/filters" + + "github.com/docker/compose/v5/pkg/api" ) func projectFilter(projectName string) filters.KeyValuePair { diff --git a/pkg/compose/generate.go b/pkg/compose/generate.go index 07999fd4ce..a23bfe8f21 100644 --- a/pkg/compose/generate.go +++ b/pkg/compose/generate.go @@ -24,11 +24,12 @@ import ( "strings" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Generate(ctx context.Context, options api.GenerateOptions) (*types.Project, error) { diff --git a/pkg/compose/hook.go b/pkg/compose/hook.go index 57c961c063..45357e388e 100644 --- a/pkg/compose/hook.go +++ b/pkg/compose/hook.go @@ -23,10 +23,11 @@ import ( "time" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/utils" "github.com/docker/docker/api/types/container" "github.com/docker/docker/pkg/stdcopy" + + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/utils" ) func (s composeService) runHook(ctx context.Context, ctr container.Summary, service types.ServiceConfig, hook types.ServiceHook, listener api.ContainerEventListener) error { diff --git a/pkg/compose/loader.go b/pkg/compose/loader.go index 6e203012cd..a0891c7032 100644 --- a/pkg/compose/loader.go +++ b/pkg/compose/loader.go @@ -25,6 +25,7 @@ import ( "github.com/compose-spec/compose-go/v2/cli" "github.com/compose-spec/compose-go/v2/loader" "github.com/compose-spec/compose-go/v2/types" + "github.com/docker/compose/v5/pkg/api" "github.com/docker/compose/v5/pkg/remote" ) diff --git a/pkg/compose/loader_test.go b/pkg/compose/loader_test.go index cdaa1ad68b..027235ef9a 100644 --- a/pkg/compose/loader_test.go +++ b/pkg/compose/loader_test.go @@ -23,9 +23,10 @@ import ( "testing" "github.com/compose-spec/compose-go/v2/cli" - "github.com/docker/compose/v5/pkg/api" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/docker/compose/v5/pkg/api" ) func TestLoadProject_Basic(t *testing.T) { diff --git a/pkg/compose/ls.go b/pkg/compose/ls.go index 99efccee27..b999e828bd 100644 --- a/pkg/compose/ls.go +++ b/pkg/compose/ls.go @@ -23,10 +23,11 @@ import ( "sort" "strings" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/sirupsen/logrus" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) List(ctx context.Context, opts api.ListOptions) ([]api.Stack, error) { diff --git a/pkg/compose/ls_test.go b/pkg/compose/ls_test.go index d3505a63ae..b444abd347 100644 --- a/pkg/compose/ls_test.go +++ b/pkg/compose/ls_test.go @@ -20,10 +20,10 @@ import ( "fmt" "testing" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" - "gotest.tools/v3/assert" + + "github.com/docker/compose/v5/pkg/api" ) func TestContainersToStacks(t *testing.T) { diff --git a/pkg/compose/model.go b/pkg/compose/model.go index d892d91944..19c65fbe8f 100644 --- a/pkg/compose/model.go +++ b/pkg/compose/model.go @@ -29,10 +29,11 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/containerd/errdefs" "github.com/docker/cli/cli-plugins/manager" - "github.com/docker/compose/v5/pkg/api" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) ensureModels(ctx context.Context, project *types.Project, quietPull bool) error { diff --git a/pkg/compose/plugins.go b/pkg/compose/plugins.go index 98bec35797..159394f6bf 100644 --- a/pkg/compose/plugins.go +++ b/pkg/compose/plugins.go @@ -33,9 +33,10 @@ import ( "github.com/containerd/errdefs" "github.com/docker/cli/cli-plugins/manager" "github.com/docker/cli/cli/config" - "github.com/docker/compose/v5/pkg/api" "github.com/sirupsen/logrus" "github.com/spf13/cobra" + + "github.com/docker/compose/v5/pkg/api" ) type JsonMessage struct { diff --git a/pkg/compose/port.go b/pkg/compose/port.go index 350369e6cc..ac64b4dfef 100644 --- a/pkg/compose/port.go +++ b/pkg/compose/port.go @@ -21,8 +21,9 @@ import ( "fmt" "strings" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Port(ctx context.Context, projectName string, service string, port uint16, options api.PortOptions) (string, int, error) { diff --git a/pkg/compose/publish.go b/pkg/compose/publish.go index e08d7d29e1..fb46660755 100644 --- a/pkg/compose/publish.go +++ b/pkg/compose/publish.go @@ -32,13 +32,14 @@ import ( "github.com/compose-spec/compose-go/v2/loader" "github.com/compose-spec/compose-go/v2/types" "github.com/distribution/reference" - "github.com/docker/compose/v5/internal/oci" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/compose/transform" "github.com/opencontainers/go-digest" "github.com/opencontainers/image-spec/specs-go" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/sirupsen/logrus" + + "github.com/docker/compose/v5/internal/oci" + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/compose/transform" ) func (s *composeService) Publish(ctx context.Context, project *types.Project, repository string, options api.PublishOptions) error { diff --git a/pkg/compose/publish_test.go b/pkg/compose/publish_test.go index 03170a08f9..52398af77c 100644 --- a/pkg/compose/publish_test.go +++ b/pkg/compose/publish_test.go @@ -23,11 +23,12 @@ import ( "github.com/compose-spec/compose-go/v2/loader" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/internal" - "github.com/docker/compose/v5/pkg/api" "github.com/google/go-cmp/cmp" v1 "github.com/opencontainers/image-spec/specs-go/v1" "gotest.tools/v3/assert" + + "github.com/docker/compose/v5/internal" + "github.com/docker/compose/v5/pkg/api" ) func Test_createLayers(t *testing.T) { diff --git a/pkg/compose/remove.go b/pkg/compose/remove.go index aee1b60d1a..3f63c9a6cc 100644 --- a/pkg/compose/remove.go +++ b/pkg/compose/remove.go @@ -21,9 +21,10 @@ import ( "fmt" "strings" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Remove(ctx context.Context, projectName string, options api.RemoveOptions) error { diff --git a/pkg/compose/restart.go b/pkg/compose/restart.go index 6b24586947..ca73b96289 100644 --- a/pkg/compose/restart.go +++ b/pkg/compose/restart.go @@ -21,10 +21,11 @@ import ( "strings" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/utils" "github.com/docker/docker/api/types/container" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/utils" ) func (s *composeService) Restart(ctx context.Context, projectName string, options api.RestartOptions) error { diff --git a/pkg/compose/run.go b/pkg/compose/run.go index 4b4eb53e8b..99a8cea0af 100644 --- a/pkg/compose/run.go +++ b/pkg/compose/run.go @@ -27,8 +27,9 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli" cmd "github.com/docker/cli/cli/command/container" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/pkg/stringid" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) RunOneOffContainer(ctx context.Context, project *types.Project, opts api.RunOptions) (int, error) { diff --git a/pkg/compose/scale.go b/pkg/compose/scale.go index 5a773b3129..4ef8134a26 100644 --- a/pkg/compose/scale.go +++ b/pkg/compose/scale.go @@ -19,6 +19,7 @@ import ( "context" "github.com/compose-spec/compose-go/v2/types" + "github.com/docker/compose/v5/internal/tracing" "github.com/docker/compose/v5/pkg/api" ) diff --git a/pkg/compose/shellout.go b/pkg/compose/shellout.go index e7f928da2e..ceea078821 100644 --- a/pkg/compose/shellout.go +++ b/pkg/compose/shellout.go @@ -26,10 +26,11 @@ import ( "github.com/docker/cli/cli-plugins/metadata" "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/flags" - "github.com/docker/compose/v5/internal" "github.com/docker/docker/client" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/propagation" + + "github.com/docker/compose/v5/internal" ) // prepareShellOut prepare a shell-out command to be ran by Compose diff --git a/pkg/compose/start.go b/pkg/compose/start.go index 608184ff24..eeb232fa66 100644 --- a/pkg/compose/start.go +++ b/pkg/compose/start.go @@ -22,11 +22,11 @@ import ( "fmt" "strings" - "github.com/docker/compose/v5/pkg/api" - containerType "github.com/docker/docker/api/types/container" - "github.com/compose-spec/compose-go/v2/types" + containerType "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Start(ctx context.Context, projectName string, options api.StartOptions) error { diff --git a/pkg/compose/top.go b/pkg/compose/top.go index 5a766cbe08..d2efdc1bc8 100644 --- a/pkg/compose/top.go +++ b/pkg/compose/top.go @@ -20,8 +20,9 @@ import ( "context" "strings" - "github.com/docker/compose/v5/pkg/api" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Top(ctx context.Context, projectName string, services []string) ([]api.ContainerProcSummary, error) { diff --git a/pkg/compose/up.go b/pkg/compose/up.go index ad1630fc3a..d5eb4d8769 100644 --- a/pkg/compose/up.go +++ b/pkg/compose/up.go @@ -30,12 +30,13 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/containerd/errdefs" "github.com/docker/cli/cli" - "github.com/docker/compose/v5/cmd/formatter" - "github.com/docker/compose/v5/internal/tracing" - "github.com/docker/compose/v5/pkg/api" "github.com/eiannone/keyboard" "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/cmd/formatter" + "github.com/docker/compose/v5/internal/tracing" + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Up(ctx context.Context, project *types.Project, options api.UpOptions) error { //nolint:gocyclo diff --git a/pkg/compose/viz.go b/pkg/compose/viz.go index 18c1af7793..cf8c440125 100644 --- a/pkg/compose/viz.go +++ b/pkg/compose/viz.go @@ -22,6 +22,7 @@ import ( "strings" "github.com/compose-spec/compose-go/v2/types" + "github.com/docker/compose/v5/pkg/api" ) diff --git a/pkg/compose/volumes.go b/pkg/compose/volumes.go index 03a12a268d..84e42b37c3 100644 --- a/pkg/compose/volumes.go +++ b/pkg/compose/volumes.go @@ -20,10 +20,11 @@ import ( "context" "slices" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/volume" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Volumes(ctx context.Context, project string, options api.VolumesOptions) ([]api.VolumesSummary, error) { diff --git a/pkg/compose/volumes_test.go b/pkg/compose/volumes_test.go index d60dc2144a..1fb99297a3 100644 --- a/pkg/compose/volumes_test.go +++ b/pkg/compose/volumes_test.go @@ -20,12 +20,13 @@ import ( "context" "testing" - "github.com/docker/compose/v5/pkg/api" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/volume" "go.uber.org/mock/gomock" "gotest.tools/v3/assert" + + "github.com/docker/compose/v5/pkg/api" ) func TestVolumes(t *testing.T) { diff --git a/pkg/compose/wait.go b/pkg/compose/wait.go index 003a1816ea..30413cb533 100644 --- a/pkg/compose/wait.go +++ b/pkg/compose/wait.go @@ -20,8 +20,9 @@ import ( "context" "fmt" - "github.com/docker/compose/v5/pkg/api" "golang.org/x/sync/errgroup" + + "github.com/docker/compose/v5/pkg/api" ) func (s *composeService) Wait(ctx context.Context, projectName string, options api.WaitOptions) (int64, error) { diff --git a/pkg/compose/watch.go b/pkg/compose/watch.go index e5625ed381..1307b426ee 100644 --- a/pkg/compose/watch.go +++ b/pkg/compose/watch.go @@ -29,14 +29,6 @@ import ( gsync "sync" "time" - pathutil "github.com/docker/compose/v5/internal/paths" - "github.com/docker/compose/v5/internal/sync" - "github.com/docker/compose/v5/internal/tracing" - "github.com/docker/compose/v5/pkg/api" - cutils "github.com/docker/compose/v5/pkg/utils" - "github.com/docker/compose/v5/pkg/watch" - "github.com/moby/buildkit/util/progress/progressui" - "github.com/compose-spec/compose-go/v2/types" "github.com/compose-spec/compose-go/v2/utils" ccli "github.com/docker/cli/cli/command/container" @@ -44,8 +36,16 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/image" "github.com/go-viper/mapstructure/v2" + "github.com/moby/buildkit/util/progress/progressui" "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" + + pathutil "github.com/docker/compose/v5/internal/paths" + "github.com/docker/compose/v5/internal/sync" + "github.com/docker/compose/v5/internal/tracing" + "github.com/docker/compose/v5/pkg/api" + cutils "github.com/docker/compose/v5/pkg/utils" + "github.com/docker/compose/v5/pkg/watch" ) type WatchFunc func(ctx context.Context, project *types.Project, options api.WatchOptions) (func() error, error) diff --git a/pkg/compose/watch_test.go b/pkg/compose/watch_test.go index d5d8cd081e..560784cd5e 100644 --- a/pkg/compose/watch_test.go +++ b/pkg/compose/watch_test.go @@ -23,10 +23,6 @@ import ( "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/streams" - "github.com/docker/compose/v5/internal/sync" - "github.com/docker/compose/v5/pkg/api" - "github.com/docker/compose/v5/pkg/mocks" - "github.com/docker/compose/v5/pkg/watch" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/image" @@ -34,6 +30,11 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" "gotest.tools/v3/assert" + + "github.com/docker/compose/v5/internal/sync" + "github.com/docker/compose/v5/pkg/api" + "github.com/docker/compose/v5/pkg/mocks" + "github.com/docker/compose/v5/pkg/watch" ) type testWatcher struct { diff --git a/pkg/e2e/cancel_test.go b/pkg/e2e/cancel_test.go index 3e8e760ae2..d3c64155d2 100644 --- a/pkg/e2e/cancel_test.go +++ b/pkg/e2e/cancel_test.go @@ -27,9 +27,10 @@ import ( "testing" "time" - "github.com/docker/compose/v5/pkg/utils" "gotest.tools/v3/assert" "gotest.tools/v3/icmd" + + "github.com/docker/compose/v5/pkg/utils" ) func TestComposeCancel(t *testing.T) { diff --git a/pkg/e2e/logs_test.go b/pkg/e2e/logs_test.go index de5c22ffe3..6250bee8c0 100644 --- a/pkg/e2e/logs_test.go +++ b/pkg/e2e/logs_test.go @@ -26,9 +26,8 @@ import ( "time" "gotest.tools/v3/assert" - "gotest.tools/v3/poll" - "gotest.tools/v3/icmd" + "gotest.tools/v3/poll" ) func TestLocalComposeLogs(t *testing.T) { diff --git a/pkg/e2e/up_test.go b/pkg/e2e/up_test.go index d659c97369..b7011391c9 100644 --- a/pkg/e2e/up_test.go +++ b/pkg/e2e/up_test.go @@ -28,10 +28,11 @@ import ( "testing" "time" - "github.com/docker/compose/v5/pkg/utils" "github.com/stretchr/testify/require" "gotest.tools/v3/assert" "gotest.tools/v3/icmd" + + "github.com/docker/compose/v5/pkg/utils" ) func TestUpServiceUnhealthy(t *testing.T) { diff --git a/pkg/e2e/wait_test.go b/pkg/e2e/wait_test.go index 37e6903e0d..171027fd9c 100644 --- a/pkg/e2e/wait_test.go +++ b/pkg/e2e/wait_test.go @@ -21,9 +21,8 @@ import ( "testing" "time" - "gotest.tools/v3/icmd" - "gotest.tools/v3/assert" + "gotest.tools/v3/icmd" ) func TestWaitOnFaster(t *testing.T) { diff --git a/pkg/remote/git.go b/pkg/remote/git.go index e49b40d83a..689f08dd90 100644 --- a/pkg/remote/git.go +++ b/pkg/remote/git.go @@ -32,9 +32,10 @@ import ( "github.com/compose-spec/compose-go/v2/loader" "github.com/compose-spec/compose-go/v2/types" "github.com/docker/cli/cli/command" - "github.com/docker/compose/v5/pkg/api" gitutil "github.com/moby/buildkit/frontend/dockerfile/dfgitutil" "github.com/sirupsen/logrus" + + "github.com/docker/compose/v5/pkg/api" ) const GIT_REMOTE_ENABLED = "COMPOSE_EXPERIMENTAL_GIT_REMOTE" diff --git a/pkg/remote/oci.go b/pkg/remote/oci.go index d74d70a091..e64570d2ab 100644 --- a/pkg/remote/oci.go +++ b/pkg/remote/oci.go @@ -30,9 +30,10 @@ import ( "github.com/containerd/containerd/v2/core/remotes" "github.com/distribution/reference" "github.com/docker/cli/cli/command" + spec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/docker/compose/v5/internal/oci" "github.com/docker/compose/v5/pkg/api" - spec "github.com/opencontainers/image-spec/specs-go/v1" ) const ( diff --git a/pkg/watch/debounce.go b/pkg/watch/debounce.go index e14da149b5..d3cddb7e63 100644 --- a/pkg/watch/debounce.go +++ b/pkg/watch/debounce.go @@ -18,9 +18,10 @@ import ( "context" "time" - "github.com/docker/compose/v5/pkg/utils" "github.com/jonboulle/clockwork" "github.com/sirupsen/logrus" + + "github.com/docker/compose/v5/pkg/utils" ) const QuietPeriod = 500 * time.Millisecond diff --git a/pkg/watch/dockerignore.go b/pkg/watch/dockerignore.go index 5dd5f343f9..ce7d57fbfe 100644 --- a/pkg/watch/dockerignore.go +++ b/pkg/watch/dockerignore.go @@ -25,9 +25,10 @@ import ( "strings" "github.com/compose-spec/compose-go/v2/types" - "github.com/docker/compose/v5/internal/paths" "github.com/moby/patternmatcher" "github.com/moby/patternmatcher/ignorefile" + + "github.com/docker/compose/v5/internal/paths" ) type dockerPathMatcher struct { diff --git a/pkg/watch/watcher_darwin.go b/pkg/watch/watcher_darwin.go index 0e8fdb4e06..e2f665a1b8 100644 --- a/pkg/watch/watcher_darwin.go +++ b/pkg/watch/watcher_darwin.go @@ -24,8 +24,9 @@ import ( "path/filepath" "time" - pathutil "github.com/docker/compose/v5/internal/paths" "github.com/fsnotify/fsevents" + + pathutil "github.com/docker/compose/v5/internal/paths" ) // A file watcher optimized for Darwin. diff --git a/pkg/watch/watcher_naive.go b/pkg/watch/watcher_naive.go index f13a679d86..2278d10a0f 100644 --- a/pkg/watch/watcher_naive.go +++ b/pkg/watch/watcher_naive.go @@ -26,9 +26,10 @@ import ( "runtime" "strings" - pathutil "github.com/docker/compose/v5/internal/paths" "github.com/sirupsen/logrus" "github.com/tilt-dev/fsnotify" + + pathutil "github.com/docker/compose/v5/internal/paths" ) // A naive file watcher that uses the plain fsnotify API.