Use the context provide to UsageWithContext public function#1837
Use the context provide to UsageWithContext public function#1837GustavoCaso wants to merge 1 commit intoshirou:masterfrom
Conversation
|
Thank you for your suggestion. gopsutil aims to support a wide range of platforms. Some of these platforms use If we were to implement such logic, I believe the best approach would be to define a separate function that handles context cancellation, and then call that function within each platform-specific |
|
To be honest, the |
Currently, at work, we use gopsutil. We wanted to use the
disk.UsageWithContextto allow setting some timeout when calling the Usage function.We realized that the function UsageWithContext does not use the ctx provided.
It think would be a good addition to this great package.
That way, the user can do:
Before adding a test or applying this pattern to other functions
*WithContext,I wanted to know if we would be okay with having it in the package. If so, I can add tests and extend the pattern to the rest of the*WithContextfunctions.Looking forward for your feedback.