Allow users to provide their own context
Objective
Most of the methods in the AWS SDK for Go have a "WithContext" variant that allows callers to pass in a context. I have found this feature useful for cancelling long-running calls when the parent context is canceled. It would be nice to have a SyncWithContext() method with equivalent functionality.
Deliverables
- [ ] A method that allows the caller to provide a context to the underlying sync code exists
Approach (optional)
It looks like the bulk of the code already accepts a context and the Sync method passes context.Background() to this code. We could add SyncWithContext() method that is identical to Sync() except that it uses a context parameter instead of Background(). Then Sync() could just call SyncWithContext() with context.Background() as a parameter.
I would like to contribute to this issue. Can I?
@RA-Balaji sure, PR is welcomed!
Kindly review the PR: https://github.com/seqsense/s3sync/pull/381