deps: remove deprecated github.com/pkg/errors

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL 2023-09-26 00:57:12 +02:00 • committed by Nicolas De loof
parent 6ecab95775
commit 4f694919ff
39 changed files with 106 additions and 99 deletions

View file

@ -18,6 +18,7 @@ package compose
import (
"context"
"errors"
"fmt"
"os"
"os/signal"
@ -37,7 +38,6 @@ import (
"github.com/docker/cli/cli/command"
"github.com/docker/compose/v2/pkg/remote"
"github.com/morikuni/aec"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

View file

@ -18,6 +18,7 @@ package compose
import (
"context"
"errors"
"fmt"
"sort"
"strings"
@ -29,7 +30,6 @@ import (
"github.com/docker/cli/cli/command"
cliformatter "github.com/docker/cli/cli/command/formatter"
cliflags "github.com/docker/cli/cli/flags"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)

View file

@ -18,13 +18,13 @@ package compose
import (
"context"
"fmt"
"strconv"
"strings"
"github.com/docker/cli/cli/command"
"github.com/compose-spec/compose-go/types"
"github.com/pkg/errors"
"golang.org/x/exp/maps"
"github.com/docker/compose/v2/pkg/api"
@ -95,12 +95,12 @@ func parseServicesReplicasArgs(args []string) (map[string]int, error) {
for _, arg := range args {
key, val, ok := strings.Cut(arg, "=")
if !ok || key == "" || val == "" {
return nil, errors.Errorf("invalid scale specifier: %s", arg)
return nil, fmt.Errorf("invalid scale specifier: %s", arg)
}
intValue, err := strconv.Atoi(val)
if err != nil {
return nil, errors.Errorf("invalid scale specifier: can't parse replica value as int: %v", arg)
return nil, fmt.Errorf("invalid scale specifier: can't parse replica value as int: %v", arg)
}
serviceReplicaTuples[key] = intValue
}

View file

@ -78,10 +78,10 @@ func runWatch(ctx context.Context, dockerCli command.Cli, backend api.Service, w
// validation done -- ensure we have the lockfile for this project before doing work
l, err := locker.NewPidfile(project.Name)
if err != nil {
return fmt.Errorf("cannot take exclusive lock for project %q: %v", project.Name, err)
return fmt.Errorf("cannot take exclusive lock for project %q: %w", project.Name, err)
}
if err := l.Lock(); err != nil {
return fmt.Errorf("cannot take exclusive lock for project %q: %v", project.Name, err)
return fmt.Errorf("cannot take exclusive lock for project %q: %w", project.Name, err)
}
if !watchOpts.noUp {

View file

@ -23,8 +23,6 @@ import (
"strings"
"github.com/docker/compose/v2/pkg/api"
"github.com/pkg/errors"
)
// Print prints formatted lists in different formats
@ -67,7 +65,7 @@ func Print(toJSON interface{}, format string, outWriter io.Writer, writerFn func
_, _ = fmt.Fprintln(outWriter, outJSON)
}
default:
return errors.Wrapf(api.ErrParsingFailed, "format value %q could not be parsed", format)
return fmt.Errorf("format value %q could not be parsed: %w", format, api.ErrParsingFailed)
}
return nil
}