Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions estargz/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"sync"
"sync/atomic"

"github.com/containerd/stargz-snapshotter/estargz/errorutil"
"github.com/klauspost/compress/zstd"
digest "github.com/opencontainers/go-digest"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -656,7 +655,7 @@ func (tf *tempFiles) cleanupAll() error {
}
}
tf.files = nil
return errorutil.Aggregate(allErr)
return errors.Join(allErr...)
}

func newCountReadSeeker(r io.ReaderAt) (*countReadSeeker, error) {
Expand Down
2 changes: 2 additions & 0 deletions estargz/errorutil/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
)

// Aggregate combines a list of errors into a single new error.
//
// Deprecated: use [errors.Join] instead. This package will be removed in v0.19.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @ktock I put v0.19.0 here, but can either remove that, or adjust to what makes sense.

func Aggregate(errs []error) error {
switch len(errs) {
case 0:
Expand Down
5 changes: 2 additions & 3 deletions estargz/estargz.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"sync"
"time"

"github.com/containerd/stargz-snapshotter/estargz/errorutil"
digest "github.com/opencontainers/go-digest"
"github.com/vbatts/tar-split/archive/tar"
)
Expand Down Expand Up @@ -164,7 +163,7 @@ func Open(sr *io.SectionReader, opt ...OpenOption) (*Reader, error) {
allErr = append(allErr, err)
}
if !found {
return nil, errorutil.Aggregate(allErr)
return nil, errors.Join(allErr...)
}
if err := r.initFields(); err != nil {
return nil, fmt.Errorf("failed to initialize fields of entries: %v", err)
Expand Down Expand Up @@ -192,7 +191,7 @@ func OpenFooter(sr *io.SectionReader) (tocOffset int64, footerSize int64, rErr e
}
allErr = append(allErr, err)
}
return 0, 0, errorutil.Aggregate(allErr)
return 0, 0, errors.Join(allErr...)
}

// initFields populates the Reader from r.toc after decoding it from
Expand Down
3 changes: 1 addition & 2 deletions estargz/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
"strings"
"time"

"github.com/containerd/stargz-snapshotter/estargz/errorutil"
"github.com/klauspost/compress/zstd"
digest "github.com/opencontainers/go-digest"
)
Expand Down Expand Up @@ -1650,7 +1649,7 @@ func newCalledTelemetry() (telemetry *Telemetry, check func(needsGetTOC bool) er
if !deserializeTocLatencyCalled {
allErr = append(allErr, fmt.Errorf("metrics DeserializeTocLatency isn't called"))
}
return errorutil.Aggregate(allErr)
return errors.Join(allErr...)
}
}

Expand Down
Loading