Skip to content
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

OSInfo singleton #387

Open
AlonZivony opened this issue Oct 26, 2023 · 3 comments
Open

OSInfo singleton #387

AlonZivony opened this issue Oct 26, 2023 · 3 comments

Comments

@AlonZivony
Copy link
Contributor

The OSInfo struct gets the system information upon initialization.
This information currently is a static information - OS version, distro, etc.
So, unless I am missing something, I propose to implement the type init function as a singleton getter, which initialize it only once per program runtime.
This way you can access it from many places in the code without fearing the performance consequences of it.

@geyslan
Copy link
Member

geyslan commented Oct 26, 2023

sync.Once could be the way.

@AlonZivony
Copy link
Contributor Author

Yea the implementation seems to me trivial.
Opened the issue to discuss if to implement this.

@rafaeldtinoco
Copy link
Contributor

Actually: #297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants