psanford / wormhole-william

End-to-end encrypted file transfer. A magic wormhole CLI and API in Go (golang).
MIT License
1.07k stars 54 forks source link

Remove channel intercept for closing files #98

Closed Jacalz closed 1 year ago

Jacalz commented 1 year ago

The code can be simplified to take in an io.ReadCloser and then close the file where necessary instead. Doing it this way avoids having to spin up a goroutine and intercept the channel to then send the information through another channel.

psanford commented 1 year ago

I find the existing code to be more clear. The owner function of the file takes responsibility for closing the file.