-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer a way to avoid using os.GetEnv #1438
Comments
Thank you for the issue and implementation. And sorry for the late reply. Personally, I don't like to give various additional information to the context and pass it on. Because the value of I thought it would be better to pass a argument as I wrote in #1420 (comment). and I think there are also a way to add variable length arguments.
However, after I read your implementation, I am beginning to think that if we are providing custom functions and using read-only values, Perhaps you will recommend |
The problem is how much you'll need to change APIs to pass the options around. The context object has the benefit of being there already, for most of the methods. |
To my understanding, adding a variable length argument does not change the API. |
I see what you mean now. Let me try this approach. Thanks! |
To clarify my thoughts, I am now inclined to the idea that it is better to use |
I'm fresh out of time but will look into it for an hour. |
I looked into it and found that we already use a vararg for a number of methods:
All those methods would need to move to use a I am in favor of the context PR. Please review and let me what you think of the comments from @rmfitzpatrick. |
Is your feature request related to a problem? Please describe.
When using gopsutil programmatically, we want to avoid relying on environment variables. We have use cases where we want to find information about processes in the container and outside the container, for example.
Describe the solution you'd like
We want to keep the current default behavior of reading from os.GetEnv. However, we also want a way to override optionally this approach by passing a map as part of the invocation.
3 approaches to this:
Describe alternatives you've considered
Still looking.
Additional context
N/A
The text was updated successfully, but these errors were encountered: