A quick one, hopefully: does Go library provide a way to get information like `uname` command returns? Kernel name, kernel version, etc? I can't see it (except for os.Hostname()) so I think I should probably exec uname.
On Thu, Jan 10, 2013 at 9:09 AM, Jan Mercl <0xj...@gmail.com> wrote:
On Thu, Jan 10, 2013 at 3:06 PM, minux <minu...@gmail.com> wrote:
> perhaps you can use syscall.Uname to achieve your goal on Unix.... or parse `/proc/something`. Example:https://github.com/cznic/fileutil/blob/master/fileutil_linux.go#L27
Yes, I may have to do that, or exec a program like uname. I didn't realize that syscall.Uname and syscall.Utsname wasn't defined on all OS'es and so my program won't compile on OS'es where it doesn't exist, like Mac for example. I guess there is no #ifdef in Go, so how does one work around this kind of problems to make a program that can compile with features that exist somewhere but not other places?
http://golang.org/pkg/go/build/#hdr-Build_Constraints