Skip to content

Commit

Permalink
feat: add ReadSeekerNopCloser
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijie-yang committed Nov 8, 2024
1 parent 5836341 commit e70da02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/testutil/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (a *TestArchive) Options() *archive.Options {
return &a.Opts
}

func (a *TestArchive) Fetch(pkgName string) (io.ReadCloser, *archive.PackageInfo, error) {
func (a *TestArchive) Fetch(pkgName string) (io.ReadSeekCloser, *archive.PackageInfo, error) {
pkg, ok := a.Packages[pkgName]
if !ok {
return nil, nil, fmt.Errorf("cannot find package %q in archive", pkgName)
Expand All @@ -37,7 +37,7 @@ func (a *TestArchive) Fetch(pkgName string) (io.ReadCloser, *archive.PackageInfo
SHA256: pkg.Hash,
Arch: pkg.Arch,
}
return io.NopCloser(bytes.NewBuffer(pkg.Data)), info, nil
return ReadSeekerNopCloser(bytes.NewReader(pkg.Data)), info, nil
}

func (a *TestArchive) Exists(pkg string) bool {
Expand Down

0 comments on commit e70da02

Please sign in to comment.