pkg/compose: remove uses of moby/errdefs

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-07-21 14:29:05 +02:00 committed by Guillaume Lours
parent 3875e13fad
commit c50d16cd78
3 changed files with 5 additions and 6 deletions

View File

@ -30,6 +30,8 @@ linters:
deny: deny:
- pkg: io/ioutil - pkg: io/ioutil
desc: io/ioutil package has been deprecated desc: io/ioutil package has been deprecated
- pkg: github.com/docker/docker/errdefs
desc: use github.com/containerd/errdefs instead.
- pkg: golang.org/x/exp/maps - pkg: golang.org/x/exp/maps
desc: use stdlib maps package desc: use stdlib maps package
- pkg: golang.org/x/exp/slices - pkg: golang.org/x/exp/slices

View File

@ -24,13 +24,13 @@ import (
"testing" "testing"
"github.com/compose-spec/compose-go/v2/types" "github.com/compose-spec/compose-go/v2/types"
"github.com/containerd/errdefs"
"github.com/docker/cli/cli/streams" "github.com/docker/cli/cli/streams"
"github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/volume" "github.com/docker/docker/api/types/volume"
"github.com/docker/docker/errdefs"
"go.uber.org/mock/gomock" "go.uber.org/mock/gomock"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
@ -326,7 +326,7 @@ func TestDownRemoveImages(t *testing.T) {
if exists { if exists {
resp.RepoTags = []string{img} resp.RepoTags = []string{img}
} else { } else {
err = errdefs.NotFound(fmt.Errorf("test specified that image %q should not exist", img)) err = errdefs.ErrNotFound.WithMessage(fmt.Sprintf("test specified that image %q should not exist", img))
} }
api.EXPECT().ImageInspect(gomock.Any(), img). api.EXPECT().ImageInspect(gomock.Any(), img).

View File

@ -18,7 +18,6 @@ package compose
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"os" "os"
"os/signal" "os/signal"
@ -32,7 +31,6 @@ import (
"github.com/docker/compose/v2/internal/tracing" "github.com/docker/compose/v2/internal/tracing"
"github.com/docker/compose/v2/pkg/api" "github.com/docker/compose/v2/pkg/api"
"github.com/docker/compose/v2/pkg/progress" "github.com/docker/compose/v2/pkg/progress"
"github.com/docker/docker/errdefs"
"github.com/eiannone/keyboard" "github.com/eiannone/keyboard"
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -222,8 +220,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
Follow: true, Follow: true,
Since: ctr.State.StartedAt, Since: ctr.State.StartedAt,
}) })
var notImplErr errdefs.ErrNotImplemented if cerrdefs.IsNotImplemented(err) {
if errors.As(err, &notImplErr) {
// container may be configured with logging_driver: none // container may be configured with logging_driver: none
// as container already started, we might miss the very first logs. But still better than none // as container already started, we might miss the very first logs. But still better than none
return s.doAttachContainer(ctx, event.Service, event.ID, event.Source, printer.HandleEvent) return s.doAttachContainer(ctx, event.Service, event.ID, event.Source, printer.HandleEvent)