sysinfo
sysinfo copied to clipboard
Cannot compile on Mac OS
This issue is related to #3
Even if the necessary system calls are not available on Mac OS (and probably Windows), it would be preferable if the library could be built (if it would be portable across all platforms golang apps can be built on). It could return a nil pointer for any info that is not available.
I wanted to use this library for a project, but the fact that I cannot compile it on MacOS means I cannot.
Thank you!
Hello @MihaiBojin.
I get where you're going. Even if the library is basically useless on Mac OS, you'd like it to at least compile, so that you can use the same code on multiple platform. Am I right?
Now, even if I would be willing to add some build constraints to help that specific case, the trouble is I don't have access to any Mac OS machine. So, I wouldn't be able to test the changes. Meaning, you or somebody else would need to step in and do the grunt work.
In the meantime, you could do that even in your project, basically having sysinfo_linux.go, and sysinfo_other.go, persuading Go compiler to compile sysinfo_linux on Linux, and sysinfo_other on any other sysinfo unsupported architecture. Then make a real call to GetSysInfo() in the Linux version, and just return nil in the other version. Basically, the same idea, just implemented in your project, where you really need it.
Hi, yes you are correct.
Yup, I can help with testing on a mac.
Came here to post on this. Would be nice if the library just compiled on mac to make app writing easier, even if there isn't any mac info to show.
Should now compile on Macos 😀
Thanks @Itxaka for your contributions. Since commit 6782e1f5e11ab06b822a8de521e6bf7081b22e87, and thanks to your other contribution in 812ca38aef428e765c76647c9b28ecf3028f62e8 GitHub CI reveals that we now happily compile and run on Mac OS, too. Even some info there, considering this is essentially Linux specific library, I guess not too bad. :smile:
{
"sysinfo": {
"version": "1.0.0",
"timestamp": "2023-05-28T17:09:21.898824Z"
},
"node": {
"machineid": "02041e1addf614c549e2b33c64738ac1",
"hypervisor": "vmware"
},
"os": {},
"kernel": {},
"product": {},
"board": {},
"chassis": {},
"bios": {},
"cpu": {
"threads": 3
},
"memory": {}
}
So, I'll close this issue now.