separate struct and func due to the lack of syscall on windows.

This commit is contained in:
WAKAYAMA Shirou 2014-04-18 21:27:29 +09:00
parent f16e9efb2e
commit 4ffbd2a28f
1 changed files with 0 additions and 24 deletions

24
host.go
View File

@ -1,10 +1,5 @@
package main package main
import (
"os"
"syscall"
)
type Host struct{} type Host struct{}
type HostInfo struct { type HostInfo struct {
@ -17,22 +12,3 @@ func NewHost() Host {
h := Host{} h := Host{}
return h return h
} }
func (h Host) HostInfo() (HostInfo, error) {
ret := HostInfo{}
sysinfo := &syscall.Sysinfo_t{}
if err := syscall.Sysinfo(sysinfo); err != nil {
return ret, err
}
hostname, err := os.Hostname()
if err != nil {
return ret, err
}
ret.Hostname = hostname
ret.Uptime = sysinfo.Uptime
ret.Procs = uint64(sysinfo.Procs)
return ret, nil
}