Most of the proposal is right there in the title. What with io/fs being rolled out in go1.16, we have a big opportunity to remodel, simplify, and rework our API. Current issues, as I see them:
- The current
sftp.Client implements github.com/kr/fs, but we could switch to model more compatible with io/fs.FS
- The in-memory test filesystem cannot be removed from the main package without a breaking change, ideally if kept, this should be a subpackage.
- The
ErrSshFxXyz errors are still around, because they cannot be removed without a breaking change.
- The
RequestServer and Server implementations are significantly different and almost parallel implementations.
- The
RequestServer could be better implemented via a base interface with additional extension interfaces. (à la io/fs)
- From an earlier discussion, many of the raw implementation concepts of the protocol itself could be isolated into its own subpackage, providing a better separation of responsibilities.
- Some features can be reassessed for utility, and either properly folded into functionality without needing feature flags (like the
allocator?) or dropped entirely (we could switch WriteTo so that it does not depend upon filesizes, thus saving us the need of an UseFstat() option).
Most of the proposal is right there in the title. What with
io/fsbeing rolled out in go1.16, we have a big opportunity to remodel, simplify, and rework our API. Current issues, as I see them:sftp.Clientimplementsgithub.com/kr/fs, but we could switch to model more compatible withio/fs.FSErrSshFxXyzerrors are still around, because they cannot be removed without a breaking change.RequestServerandServerimplementations are significantly different and almost parallel implementations.RequestServercould be better implemented via a base interface with additional extension interfaces. (à laio/fs)allocator?) or dropped entirely (we could switchWriteToso that it does not depend upon filesizes, thus saving us the need of anUseFstat()option).