Skip to content

Conversation

@dpgarrick
Copy link
Contributor

Issue

The rardecode v2.2.0 library removed the WriterTo method from its Reader and ReadCloser types, causing
compilation failures:

go test ./...
# github.com/mholt/archives [github.com/mholt/archives.test]
./rar.go:105:9: cannot use or (variable of type *rardecode.ReadCloser) as rarReader value in assignment: *rardecode.ReadCloser does not implement rarReader (missing method WriteTo)
./rar.go:109:13: cannot use rardecode.NewReader(sourceArchive, options...) (value of type *rardecode.Reader) as rarReader value in assignment: *rardecode.Reader does not implement rarReader (missing method WriteTo)
FAIL	github.com/mholt/archives [build failed]
FAIL

Solution

Removed io.WriterTo from the rarReader interface definition since it was never actually used in the archives codebase.
The interface now only requires Next() and io.Reader, which are the methods actually utilized by the RAR
extraction implementation.

Copilot AI review requested due to automatic review settings October 8, 2025 00:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a compilation error by removing the unused io.WriterTo interface constraint from the rarReader type definition to maintain compatibility with the updated rardecode v2.2.0 library.

  • Removed the unused io.WriterTo method requirement from the rarReader interface
  • Updated the rardecode dependency from v2.1.1 to v2.2.0

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
rar.go Removed io.WriterTo from rarReader interface to fix compilation error
go.mod Updated rardecode dependency to v2.2.0

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dpgarrick
Copy link
Contributor Author

Apologies in advance for the copilot auto review. Not sure why I don't have the option to disable that for external repos!

@mholt
Copy link
Owner

mholt commented Oct 9, 2025

Are we sure about this? My understanding is many of underlying io functions use WriterTo if it's implemented. So the embedded interface is to help ensure those efficiency paths will be utilized. (I know this is the case at least in HTTP/network contexts.)

@dpgarrick
Copy link
Contributor Author

The rardecode package doesn't implement WriterTo is the issue

It only decodes rar format, it does not write it

@mholt
Copy link
Owner

mholt commented Oct 9, 2025

Oh -- duh, you are right. 🤦‍♂️

Not sure how I totally forgot that our RAR is read-only.

@mholt mholt merged commit e30ac60 into mholt:main Oct 9, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants