> I think, GOOS only provide the set environment variable, nothing else. So
> if I have installed go on my system. Then yes it will work fine. But any
> other user, who does not have "Go lang" installed, this will not work on
> his system. Ass GOOS is from runtime pkg.
runtime.GOOS is the operating system for which the Go compiler and
packages were built. It's affected by the environment variable you use
when you build Go, but it's not affected by the environment when the Go
program is run.
Ian
Correct me if I am wrong please.
Alternatives for these might be:
Windows: systeminfo | findstr /C:"OS"
Should print some additional info in addition to Alex' dll call.
Linux: lsb_release -a
Should print Distro name, distro version, arch, and baseline capabilities as
per LSB (but not kernel version as per uname -a)
switch runtime.GOOS {
case "windows": // ...
case "linux": // ...
case "freebsd": // ...
}
--Benny.
--
The first essential in chemistry is that you should perform practical
work and conduct experiments, for he who performs not practical work
nor makes experiments will never attain the least degree of mastery.
-- Abu Musa Jabir ibn Hayyan (721-815)
The binary will either be PE, ELF or Mach format.