diff --git a/dagger/build.go b/dagger/build.go index 36e8f1e2..45fb3c79 100644 --- a/dagger/build.go +++ b/dagger/build.go @@ -2,13 +2,13 @@ package dagger import ( "context" + "errors" "fmt" "path" "path/filepath" cueerrors "cuelang.org/go/cue/errors" cueload "cuelang.org/go/cue/load" - "github.com/pkg/errors" "github.com/rs/zerolog/log" "dagger.cloud/go/dagger/compiler" diff --git a/dagger/client.go b/dagger/client.go index 98e1e2da..c68ad0d2 100644 --- a/dagger/client.go +++ b/dagger/client.go @@ -3,12 +3,12 @@ package dagger import ( "archive/tar" "context" + "fmt" "io" "os" "path/filepath" "strings" - "github.com/pkg/errors" "golang.org/x/sync/errgroup" "github.com/rs/zerolog/log" @@ -45,7 +45,7 @@ func NewClient(ctx context.Context, host string) (*Client, error) { } c, err := bk.New(ctx, host) if err != nil { - return nil, errors.Wrap(err, "buildkit client") + return nil, fmt.Errorf("buildkit client: %w", err) } return &Client{ c: c, @@ -143,7 +143,7 @@ func (c *Client) buildfn(ctx context.Context, env *Env, ch chan *bk.SolveStatus, return outdir.Result(ctx) }, ch) if err != nil { - return errors.Wrap(bkCleanError(err), "buildkit solve") + return fmt.Errorf("buildkit solve: %w", bkCleanError(err)) } for k, v := range resp.ExporterResponse { // FIXME consume exporter response @@ -173,7 +173,7 @@ func (c *Client) outputfn(ctx context.Context, r io.Reader) (*compiler.Value, er break } if err != nil { - return nil, errors.Wrap(err, "read tar stream") + return nil, fmt.Errorf("read tar stream: %w", err) } lg := lg. @@ -192,7 +192,7 @@ func (c *Client) outputfn(ctx context.Context, r io.Reader) (*compiler.Value, er return nil, err } if err := out.Fill(v); err != nil { - return nil, errors.Wrap(err, h.Name) + return nil, fmt.Errorf("%s: %w", h.Name, err) } } return out, nil diff --git a/dagger/env.go b/dagger/env.go index 9bd443ed..ba7aec7d 100644 --- a/dagger/env.go +++ b/dagger/env.go @@ -2,10 +2,10 @@ package dagger import ( "context" + "fmt" "cuelang.org/go/cue" cueflow "cuelang.org/go/tools/flow" - "github.com/pkg/errors" "github.com/rs/zerolog/log" "dagger.cloud/go/dagger/compiler" @@ -102,7 +102,7 @@ func (env *Env) Update(ctx context.Context, s Solver) error { // FIXME: BuildAll() to force all files (no required package..) base, err := CueBuild(ctx, p.FS()) if err != nil { - return errors.Wrap(err, "base config") + return fmt.Errorf("base config: %w", err) } // Commit return env.set( @@ -176,15 +176,15 @@ func (env *Env) set(base, input, output *compiler.Value) (err error) { stateInst, err = stateInst.Fill(base.Cue()) if err != nil { - return errors.Wrap(err, "merge base & input") + return fmt.Errorf("merge base & input: %w", err) } stateInst, err = stateInst.Fill(input.Cue()) if err != nil { - return errors.Wrap(err, "merge base & input") + return fmt.Errorf("merge base & input: %w", err) } stateInst, err = stateInst.Fill(output.Cue()) if err != nil { - return errors.Wrap(err, "merge output with base & input") + return fmt.Errorf("merge output with base & input: %w", err) } state := compiler.Wrap(stateInst.Value(), stateInst) diff --git a/dagger/fs.go b/dagger/fs.go index 6515e2dc..32f625f8 100644 --- a/dagger/fs.go +++ b/dagger/fs.go @@ -2,13 +2,13 @@ package dagger import ( "context" + "errors" "os" "path" "strings" "github.com/moby/buildkit/client/llb" bkgw "github.com/moby/buildkit/frontend/gateway/client" - "github.com/pkg/errors" fstypes "github.com/tonistiigi/fsutil/types" "dagger.cloud/go/dagger/compiler" diff --git a/dagger/pipeline.go b/dagger/pipeline.go index fbaf81ba..f7eb044e 100644 --- a/dagger/pipeline.go +++ b/dagger/pipeline.go @@ -6,7 +6,6 @@ import ( "fmt" "github.com/moby/buildkit/client/llb" - "github.com/pkg/errors" "github.com/rs/zerolog/log" "gopkg.in/yaml.v3" @@ -349,7 +348,7 @@ func (p *Pipeline) Export(ctx context.Context, op *compiler.Value) error { } contents, err := p.fs.ReadFile(ctx, source) if err != nil { - return errors.Wrapf(err, "export %s", source) + return fmt.Errorf("export %s: %w", source, err) } switch format { case "string": diff --git a/dagger/solver.go b/dagger/solver.go index 1764868a..6d49bc49 100644 --- a/dagger/solver.go +++ b/dagger/solver.go @@ -3,12 +3,12 @@ package dagger import ( "context" "encoding/json" + "fmt" "github.com/moby/buildkit/client/llb" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" "github.com/opencontainers/go-digest" - "github.com/pkg/errors" "github.com/rs/zerolog/log" ) @@ -81,7 +81,7 @@ func dumpLLB(def *llb.Definition) ([]byte, error) { for _, dt := range def.Def { var op pb.Op if err := (&op).Unmarshal(dt); err != nil { - return nil, errors.Wrap(err, "failed to parse op") + return nil, fmt.Errorf("failed to parse op: %w", err) } dgst := digest.FromBytes(dt) ent := llbOp{Op: op, Digest: dgst, OpMetadata: def.Metadata[dgst]} diff --git a/go.mod b/go.mod index c2966e09..19609379 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/emicklei/proto v1.9.0 // indirect github.com/moby/buildkit v0.8.1 github.com/opencontainers/go-digest v1.0.0 - github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.20.0 github.com/spf13/cobra v1.0.0 github.com/spf13/pflag v1.0.5