Skip to content

Commit c50d16c

Browse files
thaJeztahglours
authored andcommitted
pkg/compose: remove uses of moby/errdefs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 3875e13 commit c50d16c

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ linters:
3030
deny:
3131
- pkg: io/ioutil
3232
desc: io/ioutil package has been deprecated
33+
- pkg: github.com/docker/docker/errdefs
34+
desc: use github.com/containerd/errdefs instead.
3335
- pkg: golang.org/x/exp/maps
3436
desc: use stdlib maps package
3537
- pkg: golang.org/x/exp/slices

pkg/compose/down_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ import (
2424
"testing"
2525

2626
"github.com/compose-spec/compose-go/v2/types"
27+
"github.com/containerd/errdefs"
2728
"github.com/docker/cli/cli/streams"
2829
"github.com/docker/docker/api/types/container"
2930
"github.com/docker/docker/api/types/filters"
3031
"github.com/docker/docker/api/types/image"
3132
"github.com/docker/docker/api/types/network"
3233
"github.com/docker/docker/api/types/volume"
33-
"github.com/docker/docker/errdefs"
3434
"go.uber.org/mock/gomock"
3535
"gotest.tools/v3/assert"
3636

@@ -326,7 +326,7 @@ func TestDownRemoveImages(t *testing.T) {
326326
if exists {
327327
resp.RepoTags = []string{img}
328328
} else {
329-
err = errdefs.NotFound(fmt.Errorf("test specified that image %q should not exist", img))
329+
err = errdefs.ErrNotFound.WithMessage(fmt.Sprintf("test specified that image %q should not exist", img))
330330
}
331331

332332
api.EXPECT().ImageInspect(gomock.Any(), img).

pkg/compose/up.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package compose
1818

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

0 commit comments

Comments
 (0)